Files
Testing/header_he_user_note.php

84 lines
2.3 KiB
PHP
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
<?php
/**
* @author Ermek
* @copyright Hire-Experts LLC
* @version UserNote 1.01
*/
defined('SE_PAGE') or exit();
include_once "./header_he_core.php";
include_once "./include/class_he_user_note.php";
SE_Language::_preload(690699007);
if ( $user->user_exists && $user->level_info['level_usernote_allowed'] )
{
//USER APPS MENU
$plugin_vars['menu_user'] = array(
'file' => 'user_notes.php',
'icon' => 'he_user_note_icon.png',
'title' => 690699007
);
}
if ( $user->user_exists && $owner->user_exists && $user->user_info['user_id']!=$owner->user_info['user_id'] && $page=="profile" )
{
if ( isset($_GET['task']) && $_GET['task']=='save_user_note' )
{
$note_result = (new he_user_note())->save_note($user->user_info['user_id'], $owner->user_info['user_id'], $_GET['note']);
// he_user_note::save_note($user->user_info['user_id'], $owner->user_info['user_id'], $_GET['note']);
}
elseif ( isset($_GET['task']) && $_GET['task']=='delete_user_note' )
{
$note_result = (new he_user_note())->delete_note($user->user_info['user_id'], $owner->user_info['user_id']);
//he_user_note::delete_note($user->user_info['user_id'], $owner->user_info['user_id']);
}
if ( isset($note_result) )
{
// CONSTRUCT AND OUTPUT JSON
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
header("Content-Type: application/json");
echo json_encode($note_result);
exit();
}
$note_info = (new he_user_note())->get_note($user->user_info['user_id'], $owner->user_info['user_id']);
$smarty->assign('note_info', $note_info);
$plugin_vars['menu_profile_side'] = array(
'file' => 'profile_he_user_note.tpl',
'title' => 690699007,
'name' => 'he_user_note');
}
if ( in_array($_GET['task'], array( 'save_user_note', 'delete_user_note' )) )
{
exit();
}
// Use new template hooks
if ( is_a($smarty, 'SESmarty') )
{
$plugin_vars['uses_tpl_hooks'] = TRUE;
if ( !empty($plugin_vars['menu_user']) )
{
$smarty->assign_hook('menu_user_apps', $plugin_vars['menu_user']);
}
if( !empty($plugin_vars['menu_profile_side']) )
{
$smarty->assign_hook('profile_side', $plugin_vars['menu_profile_side']);
}
}
?>