本文整理汇总了PHP中audit函数的典型用法代码示例。如果您正苦于以下问题:PHP audit函数的具体用法?PHP audit怎么用?PHP audit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了audit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_article
public static function delete_article($articleid)
{
$db = cmsms()->GetDb();
//Now remove the article
$query = "DELETE FROM " . cms_db_prefix() . "module_news WHERE news_id = ?";
$db->Execute($query, array($articleid));
// Delete it from the custom fields
$query = 'DELETE FROM ' . cms_db_prefix() . 'module_news_fieldvals WHERE news_id = ?';
$db->Execute($query, array($articleid));
// delete any files...
$config = cmsms()->GetConfig;
$p = cms_join_path($config['uploads_path'], 'news', 'id', $articleid);
if (is_dir($p)) {
recursive_delete($p);
}
news_admin_ops::delete_static_route($articleid);
//Update search index
$mod = cms_utils::get_module('News');
$module = cms_utils::get_module('Search');
if ($module != FALSE) {
$module->DeleteWords($mod->GetName(), $articleid, 'article');
}
@$mod->SendEvent('NewsArticleDeleted', array('news_id' => $articleid));
// put mention into the admin log
audit($articleid, 'News: ' . $articleid, 'Article deleted');
}
示例2: fetch
protected function fetch($name, &$source, &$mtime)
{
debug_buffer('start global_content_get_template');
$gCms = cmsms();
$config = $gCms->GetConfig();
$gcbops = $gCms->GetGlobalContentOperations();
$oneblob = $gcbops->LoadHtmlBlobByName($name);
if ($oneblob) {
$text = $oneblob->content;
$source = $text;
$mtime = $oneblob->modified_date;
// So no one can do anything nasty, take out the php smarty tags. Use a user
// defined plugin instead.
if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) {
$source = preg_replace("/\\{\\/?php\\}/", "", $source);
}
} else {
$source = "<!-- Html blob '" . $name . "' does not exist -->";
// put mention into the admin log
audit('', 'Global Content Block: ' . $name, 'Can not open or does not exist!');
$mtime = time();
}
debug_buffer('end global_content_get_template');
return true;
}
示例3: audit
/**
* @param array $data
* @param int $level
* @param bool $deprovisioning
*
* @return bool
*/
protected function audit($data = [], $level = 6, $deprovisioning = false)
{
if (function_exists('audit')) {
// Put instance ID into the correct place
isset($data['instance']) && ($data['dfe'] = ['instance_id' => $data['instance']->instance_id_text]);
return audit($data, $level, ($deprovisioning ? 'de' : null) . 'provision');
}
return false;
}
示例4: cms_shutdown_function
function cms_shutdown_function()
{
$error = error_get_last();
if ($error['type'] == E_ERROR || $error['type'] == E_USER_ERROR) {
$str = 'ERROR DETECTED: ' . $error['message'] . ' at ' . $error['file'] . ':' . $error['line'];
debug_to_log($str);
$db = cmsms()->GetDb();
if (is_object($db)) {
// put mention into the admin log
audit('', 'ERROR', $str);
}
}
}
示例5: send_recovery_email
/**
* A function to send lost password recovery email to a specified admin user (by name)
*
* @internal
* @access private
* @param string the username
* @return results from the attempt to send a message.
*/
function send_recovery_email($username)
{
$gCms = cmsms();
$config = $gCms->GetConfig();
$userops = $gCms->GetUserOperations();
$user = $userops->LoadUserByUsername($username);
$obj = cms_utils::get_module('CMSMailer');
if ($obj == null) {
return false;
}
$obj->AddAddress($user->email, html_entity_decode($user->firstname . ' ' . $user->lastname));
$obj->SetSubject(lang('lostpwemailsubject', html_entity_decode(get_site_preference('sitename', 'CMSMS Site'))));
$url = $config['admin_url'] . '/login.php?recoverme=' . md5(md5($config['root_path'] . '--' . $user->username . md5($user->password)));
$body = lang('lostpwemail', html_entity_decode(get_site_preference('sitename', 'CMSMS Site')), $user->username, $url);
$obj->SetBody($body);
audit('', 'Core', 'Sent Lost Password Email for ' . $username);
return $obj->Send();
}
示例6: deldir
function deldir($dir)
{
$handle = opendir($dir);
while (false !== ($FolderOrFile = readdir($handle))) {
if ($FolderOrFile != "." && $FolderOrFile != "..") {
if (@is_dir("{$dir}/{$FolderOrFile}")) {
deldir("{$dir}/{$FolderOrFile}");
} else {
unlink("{$dir}/{$FolderOrFile}");
}
}
}
closedir($handle);
if (rmdir($dir)) {
// put mention into the admin log
audit('', 'Image Manager', 'Removed Directory ' . $dir);
$success = true;
}
return $success;
}
示例7: after_uploaded_file
protected function after_uploaded_file($fileobject)
{
// here we may do image handling, and other cruft.
if (is_object($fileobject) && $fileobject->name != '') {
$mod = cms_utils::get_module('FileManager');
$parms = array();
$parms['file'] = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), $fileobject->name);
if ($mod->GetPreference('create_thumbnails')) {
$thumb = cms_utils::generate_thumbnail($parms['file']);
if ($thumb) {
$params['thumb'] = $thumb;
}
}
$str = $fileobject->name . ' uploaded to ' . filemanager_utils::get_full_cwd();
if (isset($params['thumb'])) {
$str .= ' and a thumbnail was generated';
}
audit('', $mod->GetName(), $str);
$mod->SendEvent('OnFileUploaded', $parms);
}
}
示例8: array
}
if ($validinfo) {
$onetemplate = $templateops->LoadTemplateByID($template_id);
$onetemplate->name = $template;
$onetemplate->content = $content;
$onetemplate->stylesheet = $stylesheet;
$onetemplate->encoding = $encoding;
$onetemplate->active = $active;
Events::SendEvent('Core', 'EditTemplatePre', array('template' => &$onetemplate));
$result = $onetemplate->Save();
if ($result) {
#Make sure the new name is used if this is an apply
$orig_template = $template;
Events::SendEvent('Core', 'EditTemplatePost', array('template' => &$onetemplate));
// put mention into the admin log
audit($template_id, 'HTML-template: ' . $onetemplate->name, 'Edited');
if (!$apply) {
switch ($from) {
case 'content':
redirect("listcontent.php" . $urlext);
break;
case 'cssassoc':
redirect('templatecss.php' . $urlext . '&id=' . $cssid . '&type=template');
break;
case 'module_TemplateManager':
redirect('moduleinterface.php' . $urlext . '&module=TemplateManager');
break;
default:
redirect("listtemplates.php" . $urlext);
break;
}
示例9: ob_get_clean
//eval('function testfunction'.rand().'() {'.$code.'}');
$buffer = ob_get_clean();
//add error
$error[] = preg_replace('/<br \\/>/', '', $buffer);
$validinfo = false;
} else {
ob_get_clean();
}
}
if ($validinfo) {
Events::SendEvent('Core', 'EditUserDefinedTagPre', array('id' => $userplugin_id, 'name' => &$plugin_name, 'code' => &$code));
$query = "UPDATE " . cms_db_prefix() . "userplugins SET userplugin_name = " . $db->qstr($plugin_name) . ", code = " . $db->qstr($code) . ", modified_date = " . $db->DBTimeStamp(time()) . " WHERE userplugin_id = " . $db->qstr($userplugin_id);
$result = $db->Execute($query);
if ($result) {
Events::SendEvent('Core', 'EditUserDefinedTagPost', array('id' => $userplugin_id, 'name' => &$plugin_name, 'code' => &$code));
audit($userplugin_id, $plugin_name, 'Edited User Defined Tag');
if (!isset($_POST['apply'])) {
redirect("listusertags.php" . $urlext . "&message=usertagupdated");
return;
}
} else {
$error[] = lang('errorupdatingusertag');
}
}
if ($ajax) {
header('Content-Type: text/xml');
print '<?xml version="1.0" encoding="UTF-8"?>';
print '<EditUserPlugin>';
if (sizeof($error)) {
print '<Response>Error</Response>';
print '<Details><![CDATA[';
示例10: _SetModuleAdminInterfaces
/**
* _SetModuleAdminInterfaces
*
* This function sets up data structures to place modules in the proper Admin sections
* for display on section pages and menus.
*
* @since 1.10
* @access private
* @ignore
*/
private function _SetModuleAdminInterfaces()
{
if (is_array($this->_sectionCount)) {
return;
}
$this->_sectionCount = array();
$this->_modulesBySection = array();
// get the info from the cache
$usermoduleinfo = $this->_get_user_module_info();
if (!is_array($usermoduleinfo)) {
// put mention into the admin log
audit(get_userid(FALSE), 'Admin Theme', 'No module information found for user');
}
// Are there any modules with an admin interface?
foreach ($usermoduleinfo as $key => $rec) {
$section = $rec['adminsection'];
if ($section == '') {
$section == 'extensions';
}
if (!isset($this->_sectionCount[$section])) {
$this->_sectionCount[$section] = 0;
}
$data = array();
$data['key'] = $key;
$data['friendlyname'] = isset($rec['friendlyname']) ? $rec['friendlyname'] : $key;
$data['name'] = $data['friendlyname'];
$data['description'] = $rec['admindescription'] != '' ? $rec['admindescription'] : '';
$config = cmsms()->GetConfig();
$tmp = array("modules/{$key}/images/icon.gif", "modules/{$key}/icons/icons.gif", "modules/{$key}/images/icon.png", "modules/{$key}/icons/icons.png");
foreach ($tmp as $one) {
$fn = cms_join_path($config['root_path'], $one);
if (file_exists($fn)) {
$data['icon'] = $config['root_url'] . '/' . $one;
break;
}
}
$this->_modulesBySection[$section][] = $data;
$this->_sectionCount[$section]++;
}
}
示例11: set_preference
set_preference($userid, 'syntaxhighlighter', $syntaxhighlighter);
set_preference($userid, 'default_cms_language', $default_cms_lang);
set_preference($userid, 'admintheme', $admintheme);
set_preference($userid, 'bookmarks', $bookmarks);
set_preference($userid, 'hide_help_links', $hide_help_links);
set_preference($userid, 'indent', $indent);
set_preference($userid, 'enablenotifications', $enablenotifications);
set_preference($userid, 'paging', $paging);
set_preference($userid, 'date_format_string', $date_format_string);
set_preference($userid, 'default_parent', $default_parent);
set_preference($userid, 'homepage', $homepage);
set_preference($userid, 'ignoredmodules', implode(',', $ignoredmodules));
set_preference($userid, 'listtemplates_pagelimit', $listtemplates_pagelimit);
set_preference($userid, 'liststylesheets_pagelimit', $liststylesheets_pagelimit);
set_preference($userid, 'listgcbs_pagelimit', $listgcbs_pagelimit);
audit(-1, '', 'Edited User Preferences');
$page_message = lang('prefsupdated');
#redirect("index.php");
#return;
} else {
if (!isset($_POST["edituserprefs"])) {
$gcb_wysiwyg = get_preference($userid, 'gcb_wysiwyg', 1);
$wysiwyg = get_preference($userid, 'wysiwyg');
$syntaxhighlighter = get_preference($userid, 'syntaxhighlighter');
$default_cms_lang = get_preference($userid, 'default_cms_language');
$old_default_cms_lang = $default_cms_lang;
$admintheme = get_preference($userid, 'admintheme');
$bookmarks = get_preference($userid, 'bookmarks');
$indent = get_preference($userid, 'indent', true);
$enablenotifications = get_preference($userid, 'enablenotifications', 1);
$paging = get_preference($userid, 'paging', 0);
示例12: cmsms
if ($access && strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
try {
if ($submit || $apply) {
// Fill contentobj with parameters
$contentobj->SetAddMode();
$contentobj->FillParams($_POST);
$contentobj->SetOwner($userid);
$error = $contentobj->ValidateData();
if ($error === FALSE) {
$contentobj->Save();
$gCms = cmsms();
$contentops = $gCms->GetContentOperations();
$contentops->SetAllHierarchyPositions();
if ($submit) {
// put mention into the admin log
audit($contentobj->Id(), 'Content Item: ' . $contentobj->Name(), 'Added');
redirect('listcontent.php' . $urlext . '&message=contentadded');
}
}
} else {
$contentobj->FillParams($_POST);
}
} catch (CmsEditContentException $e) {
$error = $e->getMessage();
}
}
if (!$access) {
echo "<div class=\"pageerrorcontainer pageoverflow\"><p class=\"pageerror\">" . lang('noaccessto', array(lang('addcontent'))) . "</p></div>";
} else {
$tabnames = $contentobj->TabNames();
// Get a list of content_types and build the dropdown to select one
示例13: redirect
</div>
</div>
<?php
} else {
redirect('listtemplates.php' . $urlext);
}
} else {
if ($action == 'dodelete') {
$userid = get_userid();
$access = check_permission($userid, 'Remove Templates');
if ($access) {
foreach ($nodelist as $node) {
$id = $node->id;
$title = $node->name;
$node->Delete();
audit($id, $title, 'Deleted Template');
}
}
redirect("listtemplates.php" . $urlext);
} else {
if ($action == 'inactive') {
$userid = get_userid();
$permission = check_permission($userid, 'Modify Templates');
foreach ($nodelist as $node) {
if ($permission) {
if ($node->active) {
$node->active = false;
$node->Save();
}
}
}
示例14: error_log
error_log($msg);
continue;
}
$new[] = $role;
}
$orig = $user->roles;
if ($new != $orig) {
array_push($audit_changes, sprintf("Roles = <%s>", implode(", ", $new)));
$user->roles = $new;
}
if (count($audit_changes) == 0) {
$renderer->flash_success("No changes were made");
header("Location: user-list.php");
exit(0);
}
$errors = $user->errors();
if (count($errors) == 0) {
if (!$user->save()) {
array_push($errors, "Unknown error trying to save a user! Try again or contact support.");
}
}
if (count($errors) == 0) {
audit($action, sprintf("User %s [%s]", $userid, implode("; ", $audit_changes)));
$renderer->flash_success("Saved user");
header("Location: user-list.php");
} else {
$renderer->variable("errors", $errors);
$renderer->variable("mod_user", $user);
$renderer->variable("title", sprintf("Editing %s", $user->login));
$renderer->render("user-form");
}
示例15: trim
if (isset($params['prefix'])) {
$prefix = trim($params['prefix']);
}
if (!isset($params['templatecontent']) || empty($params['templatecontent'])) {
$module->SetError($this->Lang('error_missingparam'));
$module->RedirectToTab($id, $this->_current_tab, '', $the_action);
return;
}
if ($template == "" || $prefix == "") {
$module->SetError($this->Lang('error_missingparam'));
$module->RedirectToTab($id, $this->_current_tab, '', $the_action);
return;
}
$newtemplate = $prefix . $template;
// check if this template already exists
$txt = trim($module->GetTemplate($newtemplate));
if ($txt != "") {
$module->SetError($this->Lang('error_templatenameexists'));
$module->RedirectToTab($id, $this->_current_tab, '', $the_action);
return;
}
// we're ready to set it
$text = $params['templatecontent'];
//$text = cms_html_entity_decode($params['templatecontent'],ENT_QUOTES,get_encoding());
$module->SetTemplate($newtemplate, $text);
audit('', $module->GetName(), 'Added Template ' . $newtemplate);
if ($this->_current_tab != '') {
$module->RedirectToTab($id, $this->_current_tab, '', $the_action);
return;
}
$module->Redirect($id, $the_action);