functions.ajax.php
ob_end_clean();?>isSplitDBExists($url) || $extPages->isExtPageDBExists($url)) { echo 'exist'; return; } $res['id'] = $split->createSplit($name, $url); echo ($res['id']) ? json_encode($res) : 'nok'; } function editSplit($name, $url, $id) { $split = new Split(); $extPages = new ExtPages(); if($split->isSplitDBExists($url) || $extPages->isExtPageDBExists($url)) { echo 'exist'; return; } $res = $split->updateSplit($name, $url, $id); echo $res ? 'ok' : 'nok'; } function copyPage($pageId, $splitId) { $pages = new Pages(); $split = new Split(); $settings = new PageSettings(); $split_info = $split->getSplitById($splitId); $res = $pages->copyPage($pageId); if($res['id']) { $res['result'] = 'ok'; $res['split_id'] = $split_info['id']; $res['page_url'] = $split_info['url']; $settings->copySettings($pageId, $res['id']); } else { $res['result'] = 'nok'; } echo json_encode($res); } function copyExtPage($pageId) { $extPages = new ExtPages(); $settings = new PageSettings(true); $res = $extPages->copyPage($pageId); if($res['id']) { $res['result'] = 'ok'; $res['site_url'] = getSiteUrl() . '/' . $res['page_url']; $settings->copySettings($pageId, $res['id']); } else { $res['result'] = 'nok'; } echo json_encode($res); } function deleteSplit($splitId) { $split = new Split(); echo ($split->deleteSplit($splitId)) ? 'ok' : 'nok'; } function createPage($name, $split_id) { $pages = new Pages(); $res['count'] = $pages->countPagesInSplit($split_id); $res['id'] = $pages->createPage($name, $split_id); if($res['id']) { $res['result'] = 'ok'; echo json_encode($res); return; } echo 'nok'; } function changePageStatus($pageId, $status) { $pages = new Pages(); echo ($pages->changePageStatus($pageId, $status)) ? 'ok' : 'nok'; } function deletePage($pageId) { $pages = new Pages(); echo ($pages->deletePage($pageId)) ? 'ok' : 'nok'; } function deleteExtPage($pageId) { $extPages = new ExtPages(); echo ($extPages->deleteExtPage($pageId)) ? 'ok' : 'nok'; } function changeExtPageStatus($pageId, $status) { $extPages = new ExtPages(); echo ($extPages->changeExtPageStatus($pageId, $status)) ? 'ok' : 'nok'; } function createExtPage($name, $url) { $split = new Split(); $extPages = new ExtPages(); if($split->isSplitDBExists($url) || $extPages->isExtPageDBExists($url)) { echo 'exist'; return; } $res['count'] = $extPages->countExtPages(); $res['id'] = $extPages->createExtPage($name, $url); if($res['id']) { $res['result'] = 'ok'; echo json_encode($res); return; } echo 'nok'; } function saveNote($note) { $notes = new Notes(); echo $notes->updateNotes($note) ? 'ok' : 'nok'; } function savePageName($name, $page_id, $isExt) { if($isExt) { $pages = new ExtPages(); } else { $pages = new Pages(); } echo $pages->setPageName($name, $page_id) ? 'ok' : 'nok'; } function saveExtPageUrl($url, $page_id) { $pages = new ExtPages(); echo $pages->savePageUrl($url, $page_id) ? 'ok' : 'nok'; } function savePageSettings($settings, $page_id, $type, $isExt) { $pageSettings = new PageSettings($isExt); echo $pageSettings->savePageSettings($settings, $page_id, $type) ? 'ok' : 'nok'; } function getStyleSettings($page_id, $type, $isExt) { $pageSettings = new PageSettings($isExt); $res = $pageSettings->getStyleSettings($page_id, $type); echo $res ? $res : 'nok'; } function savePageContent($content, $page_id, $isExt) { if($isExt) { $pages = new ExtPages(); } else { $pages = new Pages(); } echo $pages->setPageContent($content, $page_id) ? 'ok' : 'nok'; } function saveProfile($profile) { if($profile) { $profile = (array)json_decode($profile); } else { echo 'nok'; return; } $settings = new Settings(); $saveLogin = false; $savePassword = false; if($profile['password'] && $profile['old_password']) { $oldPassword = encodePass($profile['old_password']); $currentPassword = $settings->getSetting('password'); if($oldPassword != $currentPassword) { echo 'password_error'; return; } } if($profile['login']) { $res = $settings->saveSetting('login', $profile['login']); $saveLogin = $res; } if($profile['password']) { $res = $settings->saveSetting('password', encodePass($profile['password'])); $savePassword = $res; } echo $saveLogin && $savePassword ? 'ok' : 'nok'; } function saveSocialsParams($params) { if($params) { $params = (array)json_decode($params); } else { echo 'nok'; return; } $save = false; $settings = new Settings(); if(is_array($params) && !empty($params)) { foreach ($params as $setting => $value) { $save = $settings->saveSetting($setting, $value); } } echo $save ? 'ok' : 'nok'; } function addTrafficSource($source) { if($source) { $source = (array)json_decode($source); } else { echo 'nok'; return; } $trafficSources = new TrafficSources(); $exist = $trafficSources->isTrafficSourceExist($source['value']); if(is_array($source) && !empty($source)) { $res['id'] = $trafficSources->saveTrafficSource($source['name'], $source['value']); } if($res['id']) { if($exist) { $res['exist'] = true; } $res['result'] = 'ok'; echo json_encode($res); return; } echo 'nok'; } function updateTrafficSource($name, $value, $id) { $trafficSources = new TrafficSources(); echo $trafficSources->updateTrafficSource($name, $value, $id) ? 'ok' : 'nok'; } function deleteTrafficSource($id) { $trafficSources = new TrafficSources(); echo $trafficSources->deleteTrafficSource($id) ? 'ok' : 'nok'; } function createMysqlDump() { $res = array(); $res['dump_time'] = DBDump::createDBDump(); if($res['dump_time']) { $res['result'] = 'ok'; } else { $res['result'] = 'nok'; } echo json_encode($res); } function restoreDBFromDump() { echo DBDump::restoreDBFromDump() ? 'ok' : 'nok'; } function checkForUpdate() { $newVersion = checkForUpdates(); $versionInfo = getLastVersion(); $currentVersion = (double)getCurrentVersion(); if(is_array($versionInfo) && isset($versionInfo['version'])) { $lastVersion = (double)$versionInfo['version']; } $res = array(); if(is_array($newVersion) && isset($newVersion['version'])) { $res['result'] = 'ok'; $res['version'] = $newVersion['version']; } elseif(!$newVersion && isset($lastVersion) && $lastVersion == $currentVersion) { $res['result'] = 'ok'; $res['last_version'] = true; } else { $res['result'] = 'nok'; } echo json_encode($res); } function updateNow() { $res = array(); $update = SystemUpdate::Update(); if($update) { $res['result'] = 'ok'; $res['version'] = getCurrentVersion(); } else { $res['result'] = 'nok'; } echo json_encode($res); } function getTargets() { $extPages = new ExtPages(); $pages = $extPages->getExtPages(); if(is_array($pages) && !empty($pages)) { $targets = array(); foreach($pages as $k => $v) { $targets[$k]['name'] = $v['name']; $targets[$k]['id'] = $v['id']; } $res['result'] = 'ok'; $res['targets'] = $targets; } else { $res['result'] = 'nok'; } echo json_encode($res); } function setTarget($targetId, $splitId) { $targets = new Targets(); echo $targets->setTarget($targetId, $splitId) ? 'ok' : 'nok'; } function getTargetForSplit($splitId) { $targets = new Targets(); $targetId = $targets->getTarget($splitId); $res = array(); if($targetId) { $res['result'] = 'ok'; $res['target_id'] = $targetId; } else { $res['result'] = 'nok'; } echo json_encode($res); } function getVisitsDateRange($pageId, $dateTo, $dateFrom, $statsType) { $visits = new VisitStats(); $stats = $visits->getVisitsDateRange($pageId, $dateTo, $dateFrom, $statsType); $res = array(); if($stats) { $res['result'] = 'ok'; $res['data'] = $stats; } elseif($stats === false) { $res['result'] = 'empty'; } else { $res['result'] = 'nok'; } echo json_encode($res); } function getConversionDateRange($pageId, $dateTo, $dateFrom, $statsType) { $conversion = new ConversionStats(); $stats = $conversion->getConversionDateRange($pageId, $dateTo, $dateFrom, $statsType); $res = array(); if($stats) { $res['result'] = 'ok'; $res['data'] = $stats; } elseif($stats === false) { $res['result'] = 'empty'; } else { $res['result'] = 'nok'; } echo json_encode($res); } function getVisitsByTrafficSource($pageId, $dateTo, $dateFrom, $statsType) { $visits = new VisitStats(); $stats = $visits->getVisitsByTrafficSource($pageId, $dateTo, $dateFrom, $statsType); $res = array(); if(is_array($stats) && !empty($stats)) { $res['result'] = 'ok'; $res['data'] = $stats; } elseif($stats === false) { $res['result'] = 'empty'; } else { $res['result'] = 'nok'; } echo json_encode($res); } function getConversionsByTrafficSource($pageId, $dateTo, $dateFrom, $statsType) { $conv = new ConversionStats(); $stats = $conv->getConverionsByTrafficSource($pageId, $dateTo, $dateFrom, $statsType); $res = array(); if(is_array($stats) && !empty($stats)) { $res['result'] = 'ok'; $res['data'] = $stats; } elseif($stats === false) { $res['result'] = 'empty'; } else { $res['result'] = 'nok'; } echo json_encode($res); } function checkShowSetting($option) { $settings = new Settings(); $show = $settings->getSetting($option); echo $show === 'true' ? 'ok' : 'nok'; } function setShowSetting($option, $value) { $settings = new Settings(); $set = $settings->saveSetting($option, $value); echo $set ? 'ok' : 'nok'; } function checkSerial($serial){ echo 'ok'; }{ if(!$serial) return false; if(!SYSTEM_CHECKSN_URL) return false; if(!curlEnabled()) { return false; } $post_data = http_build_query(array('serial' => $serial)); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, SYSTEM_CHECKSN_URL); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); $response = curl_exec($curl); curl_close($curl); if($response) { $response = json_decode($response, true); } echo $response['resp'] == 'valid' ? 'ok' : 'nok'; } function checkDbConnect($db_user, $db_pass, $db_name, $db_host) { $dsn = 'mysql:dbname='.$db_name.';host='.$db_host; try { $db = new PDO($dsn, $db_user, $db_pass); echo 'ok'; return; } catch (PDOException $e) { echo 'nok'; return; } } function delInstallScript() { $res = unlink(SITE_PATH . 'install.php'); echo $res ? 'ok' : 'nok'; }
дешифровал этот functions.ajax.php. добавил function checkSerial($serial){ echo 'ok'; }
установка не не продалжается при нажатии на УСТАНОВАТЬ!
скрипт шляпа? есть у кого serial?