$params['display_rules'][$displayRuleId]['ruleType'] = $displayRuleType; } else { $params['configs']['displayRulesFlag'] = 'false'; unset($params['display_rules']); } */ /*} elseif (isset($deleteRule)) { //delete rule line unset($params['display_rules'][$displayRuleId]); $params['display_rules'] = array_values($params['display_rules']); } */ if (!$notify->updateJSON_Data($params, $publish)) { Ajax::outputError('Internal server error! Try again later.'); } else { if ($reloadConfig) { $thash = $params['configs']['template_hash']; $template = Templates::getByHash($thash); $customize = new Customize($notify); $xmlTemplate = $template->getXmlContent(); if (!($reload = $notify->getJSONContent())) { Ajax::output('Can\'t reload json data!'); } } $output = new stdClass(); $output->json = $params; if ($reloadConfig) { $output->config_html = $customize->getHtml($xmlTemplate, $reload); } Ajax::output($output); }
} } } else { foreach ($templateData as $k => $i){ $newTemplateData[$k] = $templateData[$k]; } } */ if (!($update = $saved->update_JSON($template, $templateData))) { Ajax::outputError('JSON file couldn\'t be updated'); } //!copy original messages $savedJSON = $saved->getJSONContent(); $savedData = json_decode($savedJSON, true); $savedData['configs']['notify'] = $initialData['configs']['notify']; $savedData['configs']['displayRulesFlag'] = $initialData['configs']['displayRulesFlag']; $savedData['display_rules'] = $initialData['display_rules']; //$savedData['configs']['notify']['message'] = $initialData['configs']['notify']['message']; if (!$saved->updateJSON_Data($savedData)) { Ajax::outputError('JSON file couldn\'t be updated'); } //!end $notif = Notify::getByHash($hash); if (!($reload = $notif->getJSONContent())) { Ajax::output('Can\'t reload json data!'); } if ($xmlTemplate) { Ajax::output($customize->getHtml($xmlTemplate, $reload)); } else { Ajax::outputError('Internal server error. Try again later'); }
<?php Ajax::requireLoggedIn(); $hash = isset($_POST['hash']) ? trim($_POST['hash']) : trim($_GET['hash']); $notify = Notify::getByHash($hash); if (empty($notify->id) || !$notify->hasAccess()) { Ajax::outputError('You don\'t have access to this notification'); } $template = new Templates($notify->template_id); $customize = new Customize($notify); // template if (!($xmlTemplate = $template->getXmlContent())) { Ajax::outputError('Can\'t read template xml'); } $jsonData = null; // notification item data if (!($json = $notify->getJSONContent())) { $jsonData = $json; } if ($xmlTemplate) { if ($jsonData) { Ajax::output($customize->getHtml($xmlTemplate, $jsonData)); } else { Ajax::output($customize->getHtml($xmlTemplate, null)); } } else { Ajax::outputError('Internal server error. Try again later'); }