<?php // $Id: index.php,v 1.10 2009/10/26 08:35:45 nobu Exp $ include '../../../include/cp_header.php'; include_once '../functions.php'; include_once '../edit_func.php'; $op = isset($_GET['op']) ? $_GET['op'] : 'list'; define('SHORT', $xoopsDB->prefix("shortcut")); if (isset($_POST['save'])) { $data = post_vars(); $scid = intval($_POST['scid']); if (store_entry($data, $scid, 0)) { redirect_header("index.php", 1, _AM_DBUPDATED); exit; } $op = 'reg'; } elseif (isset($_POST['import'])) { $myts =& MyTextSanitizer::getInstance(); if (import_module_menu($myts->stripSlashesGPC($_POST['import']), intval($_POST['weight']))) { redirect_header("index.php", 1, _AM_DBUPDATED); exit; } else { // import error } } elseif ($op == 'delete') { $scid = intval($_POST['scid']); if ($scid) { $xoopsDB->query("DELETE FROM " . SHORT . " WHERE scid={$scid}"); $xoopsDB->query("DELETE FROM " . SHORT . " WHERE pscref={$scid}"); } redirect_header("index.php", 1, _AM_DBUPDATED);
# $Id: register.php,v 1.6 2008/07/13 12:21:14 nobu Exp $ include "../../mainfile.php"; include "functions.php"; include "edit_func.php"; if (!is_object($xoopsUser)) { $back = empty($_SERVER['HTTP_REFERER']) ? XOOPS_URL . '/' : $_SERVER['HTTP_REFERER']; redirect_header($back, 3, _NOPERM); exit; } $myts =& MyTextSanitizer::getInstance(); $uid = $xoopsUser->getVar('uid'); $scid = isset($_POST['scid']) ? intval($_POST['scid']) : 0; $data = post_vars(); $msgs = array(); if (isset($_POST['save'])) { if (store_entry($data, $scid, $uid)) { redirect_header("index.php", 1, _MD_SHORTCUT_STOREOK); exit; } $msgs[] = _MD_SHORTCUT_STORENG . ' - ' . $xoopsDB->error(); } include XOOPS_ROOT_PATH . "/header.php"; $xoopsTpl->assign('errors', $msgs); $data['url'] = normal_url($data['url']); if (!isset($_POST['scid'])) { // generate uniq id if empty if (isset($_GET['scid'])) { $scid = intval($_GET['scid']); $cond = "scid=" . $scid; if (!$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { $cond .= " AND uid=" . $xoopsUser->getVar('uid');
$local_index[$id] = $remote_index[$id]; store_entry($id, $_POST[$id]); unset($remote_entries[$id]); } } foreach ($diff_index as $id => $data) { //echo $data['timestamp']; if ($local_index[$id]['timestamp'] !== 0) { $remote_entries[$id] = get_entry($id); $remote_index[$id] = $local_index[$id]; } else { unset($remote_entries[$id]); unset($remote_index[$id]); } } store_entry('_index', $local_index); $return = array('index' => $remote_index, 'entries' => $remote_entries, 'debug' => $debug); echo json_encode($return); // Helpers function get_entry($id) { $file = DATA_DIR . '/' . $id; if (file_exists($file)) { if ($le = json_decode(file_get_contents($file), true)) { return $le; // return addslashes($le); } } return array(); } function store_entry($id, $data)
// calender JavaScript setup if (isset($weekname)) { $xoopsTpl->assign('weekname', $weekname); } if (isset($monthname)) { $xoopsTpl->assign('monthname', $monthname); } $y = formatTimestamp(time(), 'Y'); $xoopsTpl->assign('calrange', array($y - 10, $y + 10)); $title = $mid ? _MD_CONTENT_EDIT : _MD_CONTENT_NEW; $xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsModule->getVar('name') . _MD_SEP . $title)); $xoopsTpl->assign('lang_title', htmlspecialchars($title)); $preview = isset($_POST['preview']); if ($preview) { $content = new MediaContent(intval($_POST['mid'])); $content = store_entry($content); $xoopsTpl->assign('fields', $content->dispVars(false)); } else { $content = new MediaContent($mid); } $isadmin = $xoopsUser->isAdmin($xoopsModule->getVar('mid')); if ($mid && $content->getVar('status') != 'N') { // deleted content view only admin if (!$isadmin || $content->getVar('status') == 'W' && $content->getVar('poster') == $xoopsUser->getVar('uid')) { redirect_header('index.php', 3, _NOPERM); exit; } } $form = array('mid' => $mid); $nop = $mid ? array() : array('mtime', 'ctime', 'poster', 'hits'); keywords_widget($keywidget, $relays, $roots);