feat(cadline): add Cadline docroot apps + root PHPs

Docroot sub-apps beiratkozas/, iskolak/, phpext/; root PHPs crashadmin.php, crm_hardlock.class.php, login-external.php, tips.php, recaptchalib.php, configuration.php (74-byte MightySites multi-site stub, legit). public/ excluded (user data, ~219k files).

Signed-off-by: LÁZÁR Imre <imre@illusion.hu>
Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
LÁZÁR Imre AI Agent 2026-07-16 11:34:31 +02:00
parent c2cf6dab13
commit 3a62043b94
62 changed files with 7157 additions and 0 deletions

View File

View File

@ -0,0 +1,6 @@
<?php
if (!class_exists('crm_users')) require_once("../common_cadline_libraries/crm_users.class.php");
$response = Course::getCourses($_POST['id']);
echo json_encode($response);

View File

@ -0,0 +1,27 @@
<?php
$lang['go_to_dashboard'] = 'Go to Dashboard';
$lang['back_to_site'] = 'Back to page';
$lang['site_url'] = 'https://www.archlinexp.com/products/ai-render';
$lang['exercise_files'] = 'Exercise Files';
$lang['download'] = 'Download';
$lang['downloads'] = 'Downloads';
$lang['download_link'] = 'downloads';
$lang['download_txt'] = 'This page contains the materials needed to complete the course:';
$lang['complete_continue'] = 'Complete & Continue';
$lang['complete'] = 'complete';
$lang['logo'] = 'https://www.archlinexp.com/public/Logo_corner_up.png';
$lang['icon'] = '/public/DIAMOND_YELLOW.png';
$lang['url'] = 'enrollments/courses/';
$lang['color'] = '#f0c317';
$lang['linear_color'] = '#f0c317';
$lang['courses_url'] = 'https://www.archlinexp.com/education/workshops';
$lang['progress_desc'] = 'In-depth ARCHLine.XP courses and trainings at your own pace';
$lang['signIn'] = 'Sign In';
$lang['username'] = 'Username';
$lang['password'] = 'Password';
$lang['forgotUsername'] = 'Forgot your username?';
$lang['forgotPassword'] = 'Forgot your password?';
$lang['createAccount'] = 'Create account';
$lang['usernameLink'] = '/lost-user-name';
$lang['passwordLink'] = '/lost-password';
$lang['views'] = 'Students';

View File

@ -0,0 +1,27 @@
<?php
$lang['go_to_dashboard'] = 'Vissza a tanfolyamokhoz';
$lang['back_to_site'] = 'Vissza az oldalra';
$lang['site_url'] = 'https://www.archline.hu/termekek/ai-render';
$lang['exercise_files'] = 'Gyakorlati Fájlok';
$lang['download'] = 'Letöltés';
$lang['downloads'] = 'Letöltések';
$lang['download_link'] = 'letoltesek';
$lang['download_txt'] = 'Ez az oldal tartalmazza a kurzus elvégzéséhez szükséges anyagokat:';
$lang['complete_continue'] = 'Befejezés és folytatás';
$lang['complete'] = 'teljesítve';
$lang['logo'] = 'https://www.archline.hu/public/Logo_corner_up.png';
$lang['icon'] = '/public/DIAMOND_YELLOW.png';
$lang['url'] = 'beiratkozas/tanfolyamok/';
$lang['color'] = '#f0c317';
$lang['linear_color'] = '#f0c317';
$lang['courses_url'] = 'https://www.archline.hu/oktatas/workshopok';
$lang['progress_desc'] = 'Alapvető ARCHLine.XP tanfolyamok saját tempódban';
$lang['signIn'] = 'Bejelentkezés';
$lang['username'] = 'Felhasználónév';
$lang['password'] = 'Jelszó';
$lang['forgotUsername'] = 'Elfelejtette felhasználónevét?';
$lang['forgotPassword'] = 'Elfelejtette jelszavát?';
$lang['createAccount'] = 'Fiók létrehozása';
$lang['usernameLink'] = '/lost-user-name';
$lang['passwordLink'] = '/elfelejtett-jelszo';
$lang['views'] = 'Feliratkozó';

View File

@ -0,0 +1,28 @@
<?php
require_once("../common_cadline_libraries/crm_database.class.php");
require_once '../maintenance/PasswordHash.php';
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', $_SERVER['DOCUMENT_ROOT']);
require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once(JPATH_BASE . DS . 'includes' . DS . 'framework.php');
jimport('joomla.user.helper');
jimport('joomla.session.session');
$username = $_POST['username'];
$password = $_POST['password'];
$lang = $_POST['lang'];
$app = JFactory::getApplication('site');
$session = JFactory::getSession();
$credentials = array();
$credentials['username'] = $username;
$credentials['password'] = $password;
$error = $app->login($credentials);
header('Location: ' . $_POST['url']);

View File

@ -0,0 +1,98 @@
<?php
if (!class_exists('crm_users')) require_once("../common_cadline_libraries/crm_users.class.php");
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', $_SERVER['DOCUMENT_ROOT']);
require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once(JPATH_BASE . DS . 'includes' . DS . 'framework.php');
jimport('joomla.user.helper');
$url = $_POST['url'];
$id = $_POST['course'];
$lessonID = $_POST['lesson'];
$app = JFactory::getApplication('site');
$user = JFactory::getUser();
$course = (object)Course::getCourseByUrl($url);
$lessons = json_decode($course->lessons);
$i = 0;
foreach ($lessons->courses as $key => $lesson) {
$i += count($lesson->lessons->name);
}
$courseApplication = Course::getCourseApplication($course->id, $user->id);
$coursePercentage = round(100 / $i);
$courseArray = (array)$lessons->courses;
$selectedCourse = $courseArray[$id];
$lastLesson = count($selectedCourse->lessons->name);
$courses = (array)$lessons->courses;
if ($user->id > 0) {
if (empty($courseApplication)) {
$completedCourses[$id] = array();
array_push($completedCourses[$id], (int)$lessonID);
$jsonStr = '{"courses":' . json_encode($completedCourses, JSON_UNESCAPED_UNICODE) . '}';
$courseApp = array(
'course_id' => $course->id,
'user_id' => $user->id,
'percentage' => $coursePercentage
);
$id = Database::getInstance()->insert(JMLADATBAZIS . ".aleducation_applications", $courseApp, 'iii');
$query = "UPDATE `" . JMLADATBAZIS . "`.`aleducation_applications` SET completedCourses = ? WHERE id = ?";
Database::getInstance()->query($query, array('si', $jsonStr, $id));
} else {
$completedCourses = (array)json_decode($courseApplication['completedCourses'])->courses;
if ($completedCourses[$id] == null || !in_array($lessonID, $completedCourses[$id])) {
if ($completedCourses[$id] == null)
$completedCourses[$id] = array();
array_push($completedCourses[$id], (int)$lessonID);
$courseCounter = 0;
$allLesson = 0;
foreach ($completedCourses as $completedCourse) {
$courseCounter += count($completedCourse);
}
foreach ($courses as $lessonArray) {
$allLesson += count($lessonArray->lessons->name);
}
$percentage = round(($courseCounter / $allLesson) * 100);
$updatedJson = '{"courses":' . json_encode($completedCourses, JSON_UNESCAPED_UNICODE) . '}';
$query = "UPDATE `" . JMLADATBAZIS . "`.`aleducation_applications` SET completedCourses = ?, percentage = ? WHERE user_id = ? AND course_id = ?";
Database::getInstance()->query($query, array('siii', $updatedJson, $percentage, $user->id, $course->id));
}
}
}
if ((int)$lessonID < ($lastLesson - 1)) {
$nextCourse = $id;
$nextLesson = $lessonID + 2;
} else {
while (current($courseArray) !== $selectedCourse && key($courseArray) !== null)
next($courseArray);
next($courseArray);
$key = key($courseArray);
$nextCourse = $key;
$nextLesson = 1;
}
$newUrl = 'https://' . $_SERVER['HTTP_HOST'] . '/' . $url . '/';
$newUrl .= $nextCourse . '/' . $nextLesson;
header("Location: {$newUrl}");

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,422 @@
@font-face {
font-family: "toga-icons";
font-display: block;
src: url("toga-icons.eot?cb61078f48768850a8f1f9b1f8364825?#iefix") format("embedded-opentype"),
url("toga-icons.woff2?cb61078f48768850a8f1f9b1f8364825") format("woff2"),
url("toga-icons.woff?cb61078f48768850a8f1f9b1f8364825") format("woff");
}
.toga-icon {
display: inline-block;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.toga-icon:before {
font-family: toga-icons !important;
font-style: normal;
font-weight: normal !important;
vertical-align: top;
}
.toga-icon-apps:before {
content: "\f101";
}
.toga-icon-arrow-down:before {
content: "\f102";
}
.toga-icon-arrow-grow:before {
content: "\f103";
}
.toga-icon-arrow-left:before {
content: "\f104";
}
.toga-icon-arrow-redo:before {
content: "\f105";
}
.toga-icon-arrow-right:before {
content: "\f106";
}
.toga-icon-arrow-shrink:before {
content: "\f107";
}
.toga-icon-arrow-undo:before {
content: "\f108";
}
.toga-icon-arrow-up-right:before {
content: "\f109";
}
.toga-icon-arrow-up:before {
content: "\f10a";
}
.toga-icon-beta:before {
content: "\f10b";
}
.toga-icon-bookmark-fill:before {
content: "\f10c";
}
.toga-icon-bookmark-outline-add:before {
content: "\f10d";
}
.toga-icon-bookmark-outline:before {
content: "\f10e";
}
.toga-icon-bullet:before {
content: "\f10f";
}
.toga-icon-caret-fill-down:before {
content: "\f110";
}
.toga-icon-caret-fill-left:before {
content: "\f111";
}
.toga-icon-caret-fill-right:before {
content: "\f112";
}
.toga-icon-caret-fill-up-down:before {
content: "\f113";
}
.toga-icon-caret-fill-up:before {
content: "\f114";
}
.toga-icon-caret-stroke-down:before {
content: "\f115";
}
.toga-icon-caret-stroke-left:before {
content: "\f116";
}
.toga-icon-caret-stroke-right:before {
content: "\f117";
}
.toga-icon-caret-stroke-up:before {
content: "\f118";
}
.toga-icon-certificate:before {
content: "\f119";
}
.toga-icon-checkbox-empty:before {
content: "\f11a";
}
.toga-icon-checkbox-indeterminate:before {
content: "\f11b";
}
.toga-icon-checkbox-selected:before {
content: "\f11c";
}
.toga-icon-checkmark:before {
content: "\f11d";
}
.toga-icon-circle-fill-check:before {
content: "\f11e";
}
.toga-icon-circle-fill-dash:before {
content: "\f11f";
}
.toga-icon-circle-fill-info:before {
content: "\f120";
}
.toga-icon-circle-fill-x:before {
content: "\f121";
}
.toga-icon-circle-outline-info:before {
content: "\f122";
}
.toga-icon-circle-outline-play:before {
content: "\f123";
}
.toga-icon-circle-outline-price:before {
content: "\f124";
}
.toga-icon-circle-slash:before {
content: "\f125";
}
.toga-icon-cog:before {
content: "\f126";
}
.toga-icon-column-select:before {
content: "\f127";
}
.toga-icon-connection:before {
content: "\f128";
}
.toga-icon-content-assignment:before {
content: "\f129";
}
.toga-icon-content-audio:before {
content: "\f12a";
}
.toga-icon-content-discussions:before {
content: "\f12b";
}
.toga-icon-content-download:before {
content: "\f12c";
}
.toga-icon-content-exam:before {
content: "\f12d";
}
.toga-icon-content-live:before {
content: "\f12e";
}
.toga-icon-content-multimedia:before {
content: "\f12f";
}
.toga-icon-content-pdf:before {
content: "\f130";
}
.toga-icon-content-presentation:before {
content: "\f131";
}
.toga-icon-content-quiz:before {
content: "\f132";
}
.toga-icon-content-survey:before {
content: "\f133";
}
.toga-icon-content-text:before {
content: "\f134";
}
.toga-icon-content-video:before {
content: "\f135";
}
.toga-icon-data-download:before {
content: "\f136";
}
.toga-icon-data-export:before {
content: "\f137";
}
.toga-icon-data-import:before {
content: "\f138";
}
.toga-icon-discussions:before {
content: "\f139";
}
.toga-icon-document:before {
content: "\f13a";
}
.toga-icon-download:before {
content: "\f13b";
}
.toga-icon-ellipsis-v:before {
content: "\f13c";
}
.toga-icon-enrollment-add:before {
content: "\f13d";
}
.toga-icon-enrollment-remove:before {
content: "\f13e";
}
.toga-icon-envelope:before {
content: "\f13f";
}
.toga-icon-eye-slash:before {
content: "\f140";
}
.toga-icon-eye:before {
content: "\f141";
}
.toga-icon-filter:before {
content: "\f142";
}
.toga-icon-flag:before {
content: "\f143";
}
.toga-icon-folder:before {
content: "\f144";
}
.toga-icon-graph-bar:before {
content: "\f145";
}
.toga-icon-group-add:before {
content: "\f146";
}
.toga-icon-group-remove:before {
content: "\f147";
}
.toga-icon-handle-drag:before {
content: "\f148";
}
.toga-icon-header:before {
content: "\f149";
}
.toga-icon-heart-fill:before {
content: "\f14a";
}
.toga-icon-heart-outline:before {
content: "\f14b";
}
.toga-icon-home:before {
content: "\f14c";
}
.toga-icon-icon-communities:before {
content: "\f14d";
}
.toga-icon-image:before {
content: "\f14e";
}
.toga-icon-key:before {
content: "\f14f";
}
.toga-icon-link:before {
content: "\f150";
}
.toga-icon-location:before {
content: "\f151";
}
.toga-icon-lock:before {
content: "\f152";
}
.toga-icon-magnifying-glass:before {
content: "\f153";
}
.toga-icon-menu:before {
content: "\f154";
}
.toga-icon-message:before {
content: "\f155";
}
.toga-icon-minus:before {
content: "\f156";
}
.toga-icon-new-window:before {
content: "\f157";
}
.toga-icon-page-duplicate:before {
content: "\f158";
}
.toga-icon-page-new:before {
content: "\f159";
}
.toga-icon-page:before {
content: "\f15a";
}
.toga-icon-pencil:before {
content: "\f15b";
}
.toga-icon-people:before {
content: "\f15c";
}
.toga-icon-pin:before {
content: "\f15d";
}
.toga-icon-plane:before {
content: "\f15e";
}
.toga-icon-play:before {
content: "\f15f";
}
.toga-icon-plus:before {
content: "\f160";
}
.toga-icon-radio-empty:before {
content: "\f161";
}
.toga-icon-radio-selected:before {
content: "\f162";
}
.toga-icon-record:before {
content: "\f163";
}
.toga-icon-redirect:before {
content: "\f164";
}
.toga-icon-refresh:before {
content: "\f165";
}
.toga-icon-reply:before {
content: "\f166";
}
.toga-icon-report:before {
content: "\f167";
}
.toga-icon-share:before {
content: "\f168";
}
.toga-icon-shield:before {
content: "\f169";
}
.toga-icon-smiley-face:before {
content: "\f16a";
}
.toga-icon-social-facebook:before {
content: "\f16b";
}
.toga-icon-social-google-colorized:before {
content: "\f16c";
}
.toga-icon-social-google:before {
content: "\f16d";
}
.toga-icon-social-linkedIn:before {
content: "\f16e";
}
.toga-icon-social-twitter:before {
content: "\f16f";
}
.toga-icon-speaker:before {
content: "\f170";
}
.toga-icon-star-fill:before {
content: "\f171";
}
.toga-icon-star-outline:before {
content: "\f172";
}
.toga-icon-stop-sign:before {
content: "\f173";
}
.toga-icon-system-calendar:before {
content: "\f174";
}
.toga-icon-trash-can:before {
content: "\f175";
}
.toga-icon-trophy:before {
content: "\f176";
}
.toga-icon-upgrade:before {
content: "\f177";
}
.toga-icon-user-login:before {
content: "\f178";
}
.toga-icon-user-logout:before {
content: "\f179";
}
.toga-icon-view-device-desktop:before {
content: "\f17a";
}
.toga-icon-view-device-phone:before {
content: "\f17b";
}
.toga-icon-view-grid:before {
content: "\f17c";
}
.toga-icon-view-list:before {
content: "\f17d";
}
.toga-icon-view-menu:before {
content: "\f17e";
}
.toga-icon-warning:before {
content: "\f17f";
}
.toga-icon-webhook:before {
content: "\f180";
}
.toga-icon-window-maximize:before {
content: "\f181";
}
.toga-icon-window-minimize:before {
content: "\f182";
}
.toga-icon-x-dismiss:before {
content: "\f183";
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,149 @@
@font-face {
font-family: "toga-product-icons";
font-display: block;
src: url("toga-product-icons.eot?64826ba360e45496871f36411739ca3b?#iefix") format("embedded-opentype"),
url("toga-product-icons.woff2?64826ba360e45496871f36411739ca3b") format("woff2"),
url("toga-product-icons.woff?64826ba360e45496871f36411739ca3b") format("woff");
}
.toga-product-icon {
display: inline-block;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.toga-product-icon:before {
font-family: toga-product-icons !important;
font-style: normal;
font-weight: normal !important;
vertical-align: top;
}
.toga-product-icon-account:before {
content: "\f101";
}
.toga-product-icon-apps:before {
content: "\f102";
}
.toga-product-icon-blank:before {
content: "\f103";
}
.toga-product-icon-blog:before {
content: "\f104";
}
.toga-product-icon-book:before {
content: "\f105";
}
.toga-product-icon-bundle:before {
content: "\f106";
}
.toga-product-icon-certificate:before {
content: "\f107";
}
.toga-product-icon-checkmark-multicolor:before {
content: "\f108";
}
.toga-product-icon-checkmark:before {
content: "\f109";
}
.toga-product-icon-clipboard:before {
content: "\f10a";
}
.toga-product-icon-clock-small:before {
content: "\f10b";
}
.toga-product-icon-design:before {
content: "\f10c";
}
.toga-product-icon-digital-download:before {
content: "\f10d";
}
.toga-product-icon-drip-schedule:before {
content: "\f10e";
}
.toga-product-icon-feature-afterpurchase:before {
content: "\f10f";
}
.toga-product-icon-flagship:before {
content: "\f110";
}
.toga-product-icon-gift:before {
content: "\f111";
}
.toga-product-icon-handshake:before {
content: "\f112";
}
.toga-product-icon-help:before {
content: "\f113";
}
.toga-product-icon-lightbulb:before {
content: "\f114";
}
.toga-product-icon-logout:before {
content: "\f115";
}
.toga-product-icon-manage:before {
content: "\f116";
}
.toga-product-icon-market-sell:before {
content: "\f117";
}
.toga-product-icon-messages:before {
content: "\f118";
}
.toga-product-icon-microphone:before {
content: "\f119";
}
.toga-product-icon-mini-course:before {
content: "\f11a";
}
.toga-product-icon-page:before {
content: "\f11b";
}
.toga-product-icon-payouts:before {
content: "\f11c";
}
.toga-product-icon-play:before {
content: "\f11d";
}
.toga-product-icon-pre-sell:before {
content: "\f11e";
}
.toga-product-icon-preview:before {
content: "\f11f";
}
.toga-product-icon-resource-library:before {
content: "\f120";
}
.toga-product-icon-search-initial:before {
content: "\f121";
}
.toga-product-icon-search-no-result:before {
content: "\f122";
}
.toga-product-icon-settings:before {
content: "\f123";
}
.toga-product-icon-students:before {
content: "\f124";
}
.toga-product-icon-updates:before {
content: "\f125";
}
.toga-product-icon-upgrade:before {
content: "\f126";
}
.toga-product-icon-venn:before {
content: "\f127";
}
.toga-product-icon-webinar-replay:before {
content: "\f128";
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,971 @@
<?php
if (!class_exists('crm_users')) require_once("../common_cadline_libraries/crm_users.class.php");
if ($_SERVER['HTTP_HOST'] == 'www.archline.hu')
require_once('languages/hu-HU.php');
else
require_once('languages/en-GB.php');
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', $_SERVER['DOCUMENT_ROOT']);
require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once(JPATH_BASE . DS . 'includes' . DS . 'framework.php');
jimport('joomla.user.helper');
$url = $lang['url'] . $_GET['url'];
$id = $_GET['id'];
$lessonID = $_GET['lesson'] - 1;
$course = (object)Course::getCourseByUrl($url);
$lessons = json_decode($course->lessons);
$files = json_decode($course->fileDownloadLink)->files;
$image = json_decode($course->fileDownloadLink)->image;
$app = JFactory::getApplication('site');
$user = JFactory::getUser();
$courseApp = Course::getCourseApplication($course->id, $user->id);
$completedCourses = (array)json_decode($courseApp['completedCourses'])->courses;
$courseArray = (array)$lessons->courses;
$firstCourse = key($courseArray);
$nextLesson = '';
$nextCourse = '';
$percentage = 0;
if ($user->id > 0) {
$percentage = Course::getApplicationPercentage($course->id, $user->id);
}
if ($id == $lang['download_link']) {
$table = $_SERVER['HTTP_HOST'] == 'www.archline.hu' ? 'jml_content' : 'eng_content';
$query = "SELECT * FROM `" . JMLADATBAZIS . "`.`{$table}` WHERE id = ?";
Database::getInstance()->query($query, array('i', $files->article[0]));
$article = Database::getInstance()->fetchNext();
$moduleStr = Course::get_string_between($article['introtext'], '{loadmodule ', '}');
$module = explode(",", $moduleStr);
$phoca = Course::get_string_between($article['introtext'], '{phocadownload ', '}');
$introText = str_replace("{loadmodule " . $module[0] . "," . $module[1] . "}", JModuleHelper::renderModule(JModuleHelper::getModule($module[0], $module[1])), $article['introtext']);
$introText = str_replace("{phocadownload " . $phoca . "}", "<a id='download_link' href='" . $files->link[0] . "'></a>", $introText);
}
if ($lessonID != '' && $lessonID < 0 && $id != $lang['download_link'] || ($id == $lang['download_link'] && $course->fileDownloadLink == '')) {
$newUrl = 'https://' . $_SERVER['HTTP_HOST'] . '/' . $url . '/';
if ($lessonID < 0) {
if ($course->fileDownloadLink == '') {
$newUrl .= $firstCourse . '/1';
} else {
$newUrl .= $lang['download_link'];
}
} else {
$newUrl .= $firstCourse . '/1';
}
header("Location: {$newUrl}");
exit();
}
$freeLesson = $course->need_login == 0;
if ($id != '' && $id != $lang['download_link'] && $lessonID >= 0) {
$selectedCourse = $courseArray[$id];
$selectedLessonName = $selectedCourse->lessons->name[$lessonID];
$selectedLessonYt = $selectedCourse->lessons->yt_link[$lessonID];
$lastLesson = count($selectedCourse->lessons->name);
if ($lessonID > $lastLesson - 1) {
$newUrl = 'https://' . $_SERVER['HTTP_HOST'] . '/' . $url . '/';
$newUrl .= $firstCourse . '/1';
header("Location: {$newUrl}");
exit();
}
if (!$freeLesson && count($courseArray[$id]->lessons->name) > 1)
$freeLesson = $lessonID == 0;
$freeLesson = true;
$YtId = substr(strrchr(rtrim($selectedLessonYt, '/'), '/'), 1);
//$key = 'AIzaSyAAvKsDP6AF5XseRIDIezkFrrRwy-BwoeE';
$key = 'AIzaSyDmEK6HMS1-tPIVZDXwleeTST_fi6Z9TaE';
$json = file_get_contents("https://www.googleapis.com/youtube/v3/videos?part=statistics&id=" . $YtId . "&key=" . $key);
$jsonData = json_decode($json);
$views = $jsonData->items[0]->statistics->viewCount;
} else {
$nextLesson = 1;
if (current($courseArray)->lessons == null) {
next($courseArray);
$nextCourse = key($courseArray);
} else {
$nextCourse = $firstCourse;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= strip_tags($course->title) ?></title>
<link href="<?= $lang['icon'] ?>" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<link rel="stylesheet" href="/templates/shaper_helix3/css/template.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&amp;display=swap" rel="stylesheet">
<link rel="stylesheet" href="/beiratkozas/public/css/course-player-v2-72334d533118a1e90a0609999366bbe7.css">
<link href='/beiratkozas/public/css/toga-icons.css' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/beiratkozas/public/css/vendor-e0cb822bbe090c173fe20baeb13b0c48.css">
<script src="https://www.archline.hu/media/jui/js/jquery.min.js?f047cfec858cbb7542487d594104fb00"></script>
<script src="https://www.youtube.com/player_api" async></script>
<style>
.views {
font-size: 0.9rem;
margin-top: 0.5rem;
}
#login-form-div {
padding: 50px;
}
body,
button,
input,
textarea {
font-family: Open Sans;
}
._course-progress__dashboard-link_1rtg53 {
font-size: 12px !important;
}
.progress_desc {
font-size: 14px;
margin-top: 10px;
}
#signInModalLink {
cursor: pointer;
}
.login-container {
margin-top: 15%;
}
._top-bar__dashboard-link_v3q4ce .top-bar__dashboard-link__icon {
font-size: 24px;
}
.form-links {
list-style: none;
padding-left: 0px;
}
.btn-primary {
border-color: #343a84;
background-color: #3d449a;
}
.form-links>li {
padding: 2px 0;
font-size: 14px !important;
font-weight: 400;
line-height: 22px;
}
.form-links>li>a {
color: rgb(56, 151, 221) !important;
}
.top-bar__dashboard-link__anchor {
font-size: 14px;
margin-left: 20px;
}
[data-theme] .brand-color__background {
background-color: #cccccc;
}
[data-theme] .brand-color__text {
color: #cccccc;
}
[data-theme] .brand-color__dynamic-text {
color: #1d1d1d;
}
[data-theme] .brand-color__fill {
fill: #cccccc;
}
[data-theme] .brand-color__border {
border-color: #cccccc;
}
[data-theme] .brand-color__border-60-opacity {
border-color: rgba(204, 204, 204, 0.6);
}
[data-theme] .brand-color__border-60-opacity:not([disabled]):hover {
border-color: #cccccc;
}
[data-theme] .brand-color__background-30-opacity:not([disabled]):hover {
background-color: rgba(204, 204, 204, 0.3);
}
.course-player__content-item .toga-icon-checkmark::before {
color: #1d1d1d !important;
}
.course-player__chapter-item__header .toga-icon-checkmark::before {
color: #1d1d1d !important;
}
.progress-bar {
width: 100%;
margin-top: 16px;
margin-bottom: 10px;
border-radius: 2px;
overflow: hidden;
background-color: #CACCD6;
height: 4px;
}
.progress {
background: <?= $lang['color'] ?>;
background: -webkit-linear-gradient(to bottom, <?= $lang['linear_color'] ?>, <?= $lang['color'] ?>);
background: linear-gradient(to bottom, <?= $lang['linear_color'] ?>, <?= $lang['color'] ?>);
border-radius: 2px;
height: 4px;
width: 0;
transition: width 0.5s ease-in;
}
.not-completed-lesson::after {
height: calc(100% - 100px) !important;
}
.course-player__chapters-menu {
margin-top: 20px !important;
}
._button--default--small_142a8m {
text-decoration: none;
}
@media (min-width: 768px) {
._top-bar__logo_v3q4ce {
height: 2rem !important;
}
.signin-container {
width: 50% !important;
}
}
.modal {
display: none;
position: fixed;
z-index: 1;
padding-top: 100px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.4);
}
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 80%;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
-webkit-animation-name: animatetop;
-webkit-animation-duration: 0.4s;
animation-name: animatetop;
animation-duration: 0.4s
}
#login-form {
padding: 10px;
}
.form-group {
margin-bottom: 15px;
}
input[type="text"],
input[type="password"] {
display: block;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
width: 80%;
margin-left: 10%;
}
.btn:not(:disabled):not(.disabled) {
cursor: pointer;
}
.btn-primary {
border-color: #343a84;
background-color: #3d449a;
color: #fff;
}
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
#form-login-submit,
.form-links {
margin-left: 10%;
}
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: 400;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
@-webkit-keyframes animatetop {
from {
top: -300px;
opacity: 0
}
to {
top: 0;
opacity: 1
}
}
@keyframes animatetop {
from {
top: -300px;
opacity: 0
}
to {
top: 0;
opacity: 1
}
}
.close,
.signInClose {
color: #36394D;
float: right;
font-size: 28px;
font-weight: bold;
margin-top: 1vw;
}
.close:hover,
.close:focus,
.signInClose:hover,
.signInClose:focus {
text-decoration: none;
cursor: pointer;
}
.modal-header {
padding: 2px 16px;
background-color: rgba(54, 57, 77, .15);
color: #36394D;
}
.modal-body {
padding: 2px 16px;
}
#download_link,
div>a {
text-decoration: none;
color: rgb(56, 151, 221);
}
</style>
</head>
<body>
<div id="wrap">
<div id="page-content" class="ember-application">
<div id="modal-overlays"></div>
<div id="ember393" class="ember-view">
<div class="course-player _course-player_1jimy1">
<div data-theme="light-theme" id="player-wrapper" class="course-player__container _course-player__container_n1vbpj">
<a href="#main-content" class="skip-link">
Skip to main content
</a>
<header class="course-player__top-bar brand-color__background _top-bar_n1vbpj">
<div class="_container_v3q4ce">
<button id="enableMenu" aria-label="Enable menu" class="course-player__top-bar__menu-toggle brand-color__dynamic-text _top-bar__menu-toggle_v3q4ce" data-ember-action="" data-ember-action-659="659">
<span class="course-player__top-bar__menu-toggle__bar _top-bar__menu-toggle__bar_v3q4ce"></span>
<span class="course-player__top-bar__menu-toggle__bar _top-bar__menu-toggle__bar_v3q4ce"></span>
<span class="course-player__top-bar__menu-toggle__bar _top-bar__menu-toggle__bar_v3q4ce"></span>
</button>
<div class="top-bar__dashboard-link _top-bar__dashboard-link_v3q4ce">
<a href="<?= $course->id == 79 || $course->id == 80 ? $lang['site_url'] : $lang['courses_url'] ?>" data-qa="dashboard__path" class="top-bar__dashboard-link__anchor brand-color__dynamic-text">
<i aria-hidden="true" class="top-bar__dashboard-link__icon toga-icon toga-icon-caret-stroke-left brand-color__dynamic-text"></i>
<?= $course->id == 79 || $course->id == 80 ? $lang['back_to_site'] : $lang['go_to_dashboard'] ?>
</a>
</div>
<section class="course-player__top-bar__branding _top-bar__branding_v3q4ce">
<div class="_logo__container_v3q4ce">
<img src="<?= $lang['logo'] ?>" class="course-player__top-bar__logo _top-bar__logo_v3q4ce">
</div>
</section>
</div>
</header>
<div class="course-player__content _course-player__content_n1vbpj">
<nav class="course-player__left-drawer _left-drawer_n1vbpj">
<div class="course-player__course-navigation _course-navigation_t2nzf7">
<div id="ember674" class="ember-view">
<section class="course-progress__container _course-progress__container_1rtg53">
<section class="surface__container _surface__container_1yatsw _surface--default_1yatsw">
<div class="course-progress__school-name brand-color__background _course-progress__school-name_1rtg53">
<div class="_container_v3q4ce">
<button aria-label="Enable menu" class="course-player__top-bar__menu-toggle brand-color__dynamic-text _top-bar__menu-toggle_v3q4ce" data-ember-action="" data-ember-action-683="683">
<span class="course-player__top-bar__menu-toggle__bar _top-bar__menu-toggle__bar_v3q4ce"></span>
<span class="course-player__top-bar__menu-toggle__bar _top-bar__menu-toggle__bar_v3q4ce"></span>
<span class="course-player__top-bar__menu-toggle__bar _top-bar__menu-toggle__bar_v3q4ce"></span>
</button>
<div class="top-bar__dashboard-link _top-bar__dashboard-link_v3q4ce">
<a href="<?= $course->id == 79 || $course->id == 80 ? $lang['site_url'] : $lang['courses_url'] ?>" data-qa="dashboard__path" class="top-bar__dashboard-link__anchor brand-color__dynamic-text">
<i aria-hidden="true" class="top-bar__dashboard-link__icon toga-icon toga-icon-caret-stroke-left brand-color__dynamic-text"></i>
<?= $course->id == 79 || $course->id == 80 ? $lang['back_to_site'] : $lang['go_to_dashboard'] ?>
</a>
</div>
<section class="course-player__top-bar__branding _top-bar__branding_v3q4ce">
<div class="_logo__container_v3q4ce">
<img src="<?= $lang['logo'] ?>">
</div>
</section>
</div>
</div>
<div class="course-progress__inner-container _course-progress__inner-container_1rtg53">
<a href="<?= $course->id == 79 || $course->id == 80 ? $lang['site_url'] : $lang['courses_url'] ?>" class="course-progress__dashboard-link _course-progress__dashboard-link_1rtg53"><?= $course->id == 79 || $course->id == 80 ? $lang['back_to_site'] : $lang['go_to_dashboard'] ?></a>
<h1 class="course-progress__title _course-progress__title_1rtg53"><?= $course->title ?></h1>
<?php if ($id != '' && $id != $lang['download_link']) : ?>
<div class="views"><?= $lang['views'] ?>: <b><?= $views + $course->views ?></b></div>
<?php endif; ?>
<div class="_course-progress__actions-container_1rtg53">
<div class="progress-bar">
<div data-size="<?= $percentage ?>" class="progress"></div>
</div>
<p class="course-progress__percent-complete _course-progress__percent-complete_1rtg53"><span><?= $percentage ?>%</span> <?= $lang['complete'] ?></p>
<?php if ($user->id <= 0) : ?>
<div class="progress_desc"><?= $lang['progress_desc'] ?></div>
<?php endif; ?>
</div>
</div>
</section>
</section>
</div>
<div id="ember706" class="ember-view">
</div>
<div role="navigation" aria-label="Chapters" class="course-player__chapters-menu ">
<?php $j = 1; ?>
<?php foreach ($lessons->courses as $key => $lesson) : ?>
<div class="course-player__chapters-item _chapters-item_1tqvoe ember-view ui-accordion ui-widget ui-helper-reset" role="tablist">
<div data-id="<?= $j ?>" class="accordion course-player__chapter-item__header _chapter-item__header_d57kmg ui-accordion-header ui-corner-top ui-accordion-header-collapsed ui-corner-all ui-state-default ui-accordion-icons" role="tab" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0"><span class="ui-accordion-header-icon ui-icon ui-icon-triangle-1-e"></span>
<div class="course-player__chapter-item__container _chapter-item__container_d57kmg">
<span class="course-player__progress _chapter-item__progress_d57kmg">
<?php if (count($completedCourses[$key]) == count($lesson->lessons->name)) : ?>
<span data-percentage-completion="100" role="progressbar" aria-label="Complete progress for Overview and Preparation" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100" class="_chapter-item__progress-ring_d57kmg">
<span class="progress-ring__ring _progress-ring__ring_jgsecr">
<span class="progress-ring__mask progress-ring--full _progress-ring__mask_jgsecr _progress-ring--full_jgsecr">
<span class="progress-ring--fill brand-color__background _progress-ring--fill_jgsecr"></span>
</span>
<span class="progress-ring__mask progress-ring--half _progress-ring__mask_jgsecr ">
<span class="progress-ring--fill brand-color__background _progress-ring--fill_jgsecr"></span>
<span class="progress-ring--fill progress-ring--fix _progress-ring--fill_jgsecr _progress-ring--fix_jgsecr"></span>
</span>
</span>
<span class="progress-ring__ring-inset _progress-ring__ring-inset_jgsecr"></span>
<span class="progress-ring__checkmark brand-color__text _progress-ring__checkmark_jgsecr"><i role="img" aria-label="Completed" class="toga-icon toga-icon-checkmark"></i></span>
</span>
<?php else : ?>
<span role="progressbar" class="_chapter-item__progress-ring_d57kmg">
<span class="progress-ring__ring _progress-ring__ring_jgsecr">
<span class="progress-ring__mask progress-ring--full _progress-ring__mask_jgsecr _progress-ring--full_jgsecr">
<span class="progress-ring--fill brand-color__background _progress-ring--fill_jgsecr"></span>
</span>
<span class="progress-ring__mask progress-ring--half _progress-ring__mask_jgsecr ">
<span class="progress-ring--fill brand-color__background _progress-ring--fill_jgsecr"></span>
<span class="progress-ring--fill progress-ring--fix _progress-ring--fill_jgsecr _progress-ring--fix_jgsecr"></span>
</span>
</span>
<span class="progress-ring__ring-inset _progress-ring__ring-inset_jgsecr"></span>
<span class="progress-ring__checkmark brand-color__text _progress-ring__checkmark_jgsecr"><i role="img" aria-label="Completed" class="toga-icon toga-icon-checkmark"></i></span>
</span>
<?php endif; ?>
</span>
<h2 class="_chapter-item__title_d57kmg"><?= $lesson->name ?></h2>
<span aria-hidden="true" class="course-player__chapter-item__completion _chapter-item__completion_d57kmg">
<?= count($completedCourses[$key]) ?> / <?= count($lesson->lessons->name) ?>
</span>
<span class="course-player__chapter-item__toggle _chapter-item__toggle_d57kmg">
<i id="icon-<?= $j ?>" aria-hidden="true" class="chapter-item__toggle-icon toga-icon toga-icon-caret-stroke-down _chapter-item__toggle-icon_d57kmg"></i>
</span>
</div>
</div>
<div class="ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-<?= $j ?>" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" <?= $key == $id || ($id == $lang['download_link'] && $j == 1) ? '' : 'style="display: none;"' ?>>
<ul class="course-player__chapter-item__contents _chapter-item__contents_d57kmg">
<?php if ($lesson->lessons == null && ($key == 'overview-and-preparation' || mb_strtolower($key) == 'áttekintés-és-előkészítés')) : ?>
<?php if (($key == 'overview-and-preparation' || mb_strtolower($key) == 'áttekintés-és-előkészítés') && $course->fileDownloadLink != '') : ?>
<li data-qa="content-item" class="course-player__content-item released content-item__progress--active _content-item_nffvg8" data-ember-action="" data-ember-action-784="784">
<a href="<?= '/' . $url . '/' . $lang['download_link'] ?>" id="ember789" class="course-player__content-item__link _content-item__link_nffvg8 <?= $id == $lang['download_link'] ? 'active' : '' ?> ember-view">
<div class="brand-color__text _content-item__progress_nffvg8">
<i aria-hidden="true" class="content-item__progress-icon content-item__progress-icon--circle--active course-player__content-item__progress-icon _content-item__progress-icon_nffvg8"></i>
</div>
<div class="content-item__title _content-item__title_nffvg8">
<?= $lang['downloads'] ?>
</div>
</a>
</li>
<?php endif; ?>
<?php else : ?>
<?php for ($i = 0; $i < count($lesson->lessons->name); $i++) : ?>
<?php if ($i == 0 && $j == 1 && $course->fileDownloadLink != '') : ?>
<li data-qa="content-item" class="course-player__content-item released content-item__progress--active _content-item_nffvg8" data-ember-action="" data-ember-action-784="784">
<a href="<?= '/' . $url . '/' . $lang['download_link'] ?>" id="ember789" class="course-player__content-item__link _content-item__link_nffvg8 <?= $id == $lang['download_link'] ? 'active' : '' ?> ember-view">
<div class="brand-color__text _content-item__progress_nffvg8">
<i aria-hidden="true" class="content-item__progress-icon content-item__progress-icon--circle--active course-player__content-item__progress-icon _content-item__progress-icon_nffvg8"></i>
</div>
<div class="content-item__title _content-item__title_nffvg8">
<?= $lang['downloads'] ?>
</div>
</a>
</li>
<?php endif; ?>
<li data-qa="content-item" class="course-player__content-item released content-item__progress--complete _content-item_nffvg8">
<a href="<?= '/' . $url . '/' . $key . '/' . ($i + 1) ?>" id="ember815" class="course-player__content-item__link _content-item__link_nffvg8 ember-view <?= $i == $lessonID && $key == $id ? 'active' : '' ?>">
<?php if (in_array($i, $completedCourses[$key])) : ?>
<div class="brand-color__text _content-item__progress_nffvg8">
<i role="img" class="toga-icon toga-icon-checkmark course-player__content-item__progress-icon _content-item__progress-icon_nffvg8"></i>
</div>
<?php else : ?>
<div class="brand-color__text _content-item__progress_nffvg8 not-completed-lesson">
<i aria-hidden="true" class="content-item__progress-icon content-item__progress-icon--circle--active course-player__content-item__progress-icon _content-item__progress-icon_nffvg8"></i>
</div>
<?php endif; ?>
<div class="content-item__title _content-item__title_nffvg8">
<?= ($i + 1) . '. ' . $lesson->lessons->name[$i] ?>
</div>
</a>
</li>
<?php endfor; ?>
<?php endif; ?>
</ul>
</div>
</div>
<?php $j++; ?>
<?php endforeach; ?>
</div>
</div>
</nav>
<main id="main-content" tabindex="-1" class="course-player__lesson _course-player__lesson_n1vbpj">
<section class="surface__container _surface__container_1yatsw _surface--content_1yatsw">
<div class="_content-surface_n1vbpj">
<div class="course-player__content-header _content-header__container_h7ytgy">
<div class="_content-header__title-container_h7ytgy">
<h3 class="course-player__content-header__title _content-header__title_h7ytgy">
<?php if ($id == '' || $id == $lang['download_link']) : ?>
<?= $lang['exercise_files'] ?>
<?php else : ?>
<?= $selectedLessonName ?>
<?php endif; ?>
</h3>
</div>
</div>
<div class="content-modal-wrapper _content-modal-wrapper_n1vbpj">
<div class="content-modal _content-modal_n1vbpj">
<section id="content-inner" class="course-player__content-inner _content-inner_n1vbpj">
<?php if (($id == '' || $id == $lang['download_link']) && $course->fileDownloadLink != '') : ?>
<div class="course-player__download _download__container_1gafvp">
<div id="ember1090" class="ember-view">
</div>
<div class="course-player__download__description">
<div id="ember1095" class="ember-view">
<div class="custom-theme">
<div class="fr-view">
<div class="fr-view">
<p><?= $lang['download_txt'] ?></p>
</div>
</div>
</div>
</div>
</div>
<div class="_download__files_1gafvp">
<?php for ($i = 0; $i < count($files->name); $i++) : ?>
<div class="ember-view">
<ul class="course-player__download-files__list _download-files_1j5gba">
<li class="course-player__download-files__list-item _download-files__item_1j5gba">
<div class="course-player__download-files__details _download-files__details_1j5gba">
<span class="course-player__download-files__label _download-files__label_1j5gba">
<?= $files->name[$i] ?>
</span>
</div>
<div class="course-player__download-files__menu _download-files__menu-container_1j5gba">
<a href="<?= $files->link[$i] ?>" target="_blank" class=" _button--default_142a8m _button--link_142a8m">
<div class="_content__wrapper_142a8m">
<div class="_content__container_142a8m">
<span>
<?= $lang['download'] ?>
<span class="sr-only">Opens in a new window</span>
</span>
</div>
</div>
</a>
</div>
</li>
</ul>
</div>
<?php endfor; ?>
</div>
<?php if ($image != null && $image != ''): ?>
<img src="<?= $image ?>" alt="">
<?php endif; ?>
</div>
<?php else : ?>
<?php if ($freeLesson || $user->id > 0) : ?>
<input type="hidden" id="videoID" value="<?= substr(strrchr(rtrim($selectedLessonYt, '/'), '/'), 1) ?>">
<div id="video" class="_videoproxy__iframe_3iu414"></div>
<?php else : ?>
<form action="/beiratkozas/login.php" method="post" id="login-form-div">
<div id="form-login-username" class="form-group">
<input id="modlgn-username" type="text" name="username" class="form-control" tabindex="0" size="18" placeholder="<?= $lang['username'] ?>" required>
</div>
<div id="form-login-password" class="form-group">
<div class="controls">
<input id="modlgn-passwd" type="password" name="password" class="form-control" tabindex="0" size="18" placeholder="<?= $lang['password'] ?>" required>
</div>
</div>
<div id="form-login-submit" class="form-group">
<button type="submit" tabindex="0" name="Submit" class="btn btn-primary"><?= $lang['signIn'] ?></button>
<a class="btn btn-success" href="/fiok-letrehozasa/" target="_blank"><?= $lang['createAccount'] ?> <span class="icon-arrow-right"></span></a>
</div>
<ul class="form-links">
<li>
<a href="<?= $lang['usernameLink'] ?>" target="_blank">
<?= $lang['forgotUsername'] ?>
</a>
</li>
<li>
<a href="<?= $lang['passwordLink'] ?>" target="_blank">
<?= $lang['forgotPassword'] ?>
</a>
</li>
</ul>
<input type="hidden" name="url" value="<?= $_SERVER['REQUEST_URI'] ?>">
<input type="hidden" name="option" value="com_users">
<input type="hidden" name="task" value="user.login">
<input type="hidden" name="return" value="aHR0cHM6Ly93d3cuYXJjaGxpbmUuaHUvYmVpcmF0a296YXMvdGFuZm9seWFtb2svYWxhcGZvayVDMyVCQS10YW5mb2x5YW0tMjAyMi9sZXRvbHRlc2Vr">
<input type="hidden" name="df7241a4fa1b3a72bef63402f1446320" value="1">
</form>
<?php endif; ?>
<?php endif; ?>
</section>
<footer id="course-player-footer" data-navigation="content" class="course-player__content-navigation _content-navigation_apmbd3 _no-audio_apmbd3">
<?php if ($id == '' || $id == $lang['download_link']) : ?>
<a href="<?= '/' . $url . '/' . $nextCourse . '/' . $nextLesson ?>" class="brand-color__background brand-color__dynamic-text _button--default--small_142a8m _button--icon-right--small_142a8m link-button">
<div class="_content__wrapper_142a8m">
<div class="_content__container_142a8m">
<span>
<?= $lang['complete_continue'] ?>
</span>
<i aria-hidden="true" class="toga-icon toga-icon-arrow-right"></i>
</div>
</div>
</a>
<?php else : ?>
<form id="process-form" action="/beiratkozas/process.php" method="post">
<input type="hidden" name="url" value="<?= $url ?>">
<input type="hidden" name="course" value="<?= $id ?>">
<input type="hidden" name="lesson" value="<?= $lessonID ?>">
<button class="brand-color__background brand-color__dynamic-text _button--default--small_142a8m _button--icon-right--small_142a8m">
<div class="_content__wrapper_142a8m">
<div class="_content__container_142a8m">
<span>
<?= $lang['complete_continue'] ?>
</span>
<i aria-hidden="true" class="toga-icon toga-icon-arrow-right"></i>
</div>
</div>
</button>
</form>
<?php endif; ?>
</footer>
</div>
</div>
</div>
</section>
</main>
<aside class="course-player__right-drawer _right-drawer_n1vbpj">
<div class="course-player__course-discussions _course-discussions_n1vbpj">
</div>
</aside>
</div>
</div>
<div id="ember463" class="ember-notify-cn ember-notify-default ember-view">
</div>
</div>
</div>
</div>
<div id="push"></div>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<span class="close">&times;</span>
<h2>ARCHLINE.XP SOFTWARE LICENSE AGREEMENT</h2>
</div>
<div class="modal-body">
<p><?= $introText ?></p>
</div>
</div>
</div>
<!-- Sign In Modal -->
<?php if ($user->id <= 0) : ?>
<div id="signInModal" class="modal">
<div class="modal-content signin-container">
<div class="modal-header">
<span class="signInClose">&times;</span>
<h2><?= $lang['signIn'] ?></h2>
</div>
<div class="modal-body-signIn">
<form action="/beiratkozas/login.php" method="post" id="login-form">
<div id="form-login-username" class="form-group">
<input id="modlgn-username" type="text" name="username" class="form-control" tabindex="0" size="18" placeholder="<?= $lang['username'] ?>" required>
</div>
<div id="form-login-password" class="form-group">
<div class="controls">
<input id="modlgn-passwd" type="password" name="password" class="form-control" tabindex="0" size="18" placeholder="<?= $lang['password'] ?>" required>
</div>
</div>
<div id="form-login-submit" class="form-group">
<button type="submit" tabindex="0" name="Submit" class="btn btn-primary"><?= $lang['signIn'] ?></button>
<a class="btn btn-success" href="/fiok-letrehozasa/" target="_blank"><?= $lang['createAccount'] ?> <span class="icon-arrow-right"></span></a>
</div>
<ul class="form-links">
<li>
<a href="<?= $lang['usernameLink'] ?>" target="_blank">
<?= $lang['forgotUsername'] ?>
</a>
</li>
<li>
<a href="<?= $lang['passwordLink'] ?>" target="_blank">
<?= $lang['forgotPassword'] ?>
</a>
</li>
</ul>
<input type="hidden" name="url" value="<?= $_SERVER['REQUEST_URI'] ?>">
<input type="hidden" name="option" value="com_users">
<input type="hidden" name="task" value="user.login">
<input type="hidden" name="return" value="aHR0cHM6Ly93d3cuYXJjaGxpbmUuaHUvYmVpcmF0a296YXMvdGFuZm9seWFtb2svYWxhcGZvayVDMyVCQS10YW5mb2x5YW0tMjAyMi9sZXRvbHRlc2Vr">
<input type="hidden" name="df7241a4fa1b3a72bef63402f1446320" value="1">
</form>
</div>
</div>
</div>
<?php endif; ?>
<script>
const progress_bars = document.querySelectorAll('.progress');
var player;
var modal = document.getElementById("myModal");
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];
if (btn) {
btn.onclick = function() {
modal.style.display = "block";
}
}
if (span) {
span.onclick = function() {
modal.style.display = "none";
}
}
var signInModal = document.getElementById("signInModal");
var signInBtn = document.getElementById("signInModalLink");
var signInSpan = document.getElementsByClassName("signInClose")[0];
if (signInBtn) {
signInBtn.onclick = function() {
signInModal.style.display = "block";
}
}
if (signInSpan) {
signInSpan.onclick = function() {
signInModal.style.display = "none";
}
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
function onYouTubePlayerAPIReady() {
player = new YT.Player('video', {
height: '721',
videoId: jQuery('#videoID').val(),
playerVars: {
autoplay: 1,
controls: 1,
showinfo: 1,
autohide: 1,
modestbranding: 1,
origin: 'https://www.archline.hu'
},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady(event) {
event.target.playVideo();
}
function onPlayerStateChange(event) {
if (event.data === 0)
jQuery('form#process-form').submit();
}
progress_bars.forEach(bar => {
setTimeout(() => {
const {
size
} = bar.dataset;
bar.style.width = `${size}%`
}, 1000);
});
jQuery(document).ready(function() {
jQuery('#download_link').html(jQuery('.phocadownloadfile32').html());
jQuery('#enableMenu').click(function() {
jQuery('._course-player__content_n1vbpj').toggleClass('left-drawer--open');
jQuery('.course-player__top-bar').toggleClass('left-drawer--open');
});
jQuery('.accordion').click(function() {
let dataId = jQuery(this).attr('data-id');
jQuery('#icon-' + dataId).toggleClass('toga-icon-caret-stroke-up');
jQuery('#icon-' + dataId).toggleClass('toga-icon-caret-stroke-down');
jQuery('#ui-id-' + dataId).slideToggle();
});
jQuery('#elfogad').click(function() {
jQuery('#enabled').toggleClass('phocadownloadfile32');
});
$('.course-player__left-drawer').animate({
scrollTop: $(".active").offset().top - 450
}, 0);
});
</script>
</body>
</html>

View File

@ -0,0 +1 @@
<?php require_once(__DIR__.'/components/com_mightysites/mightysites.php');

View File

@ -0,0 +1,422 @@
<?php
die();
error_reporting(E_ERROR | E_PARSE);
session_start();
include('config.php');
$connection = new mysqli($config2['db_host'], $config2['db_user'], $config2['db_pass'], $config2['db_name']);
if (isset($_POST['submit'])) {
if ($_POST['modId']) {
$id = $_POST['modId'];
$text = mysqli_real_escape_string($connection, $_POST['modText']);
$update = "UPDATE `www_archline_hu`.`crash` SET `komment`='{$text}' WHERE `id`='{$id}'";
if ($connection->query($update) === FALSE) echo '<script type="text/javascript">alert("' . $connection->error . '");</script>';
}
if ($_POST['listaid'] && isset($_POST['CbBoxValue'])) {
$listaid = substr($_POST['listaid'], 5);
$update = "UPDATE `www_archline_hu`.`crash` SET `eredmeny`='{$_POST['CbBoxValue']}' WHERE `id`='{$listaid}'";
if ($connection->query($update) === FALSE) echo '<script type="text/javascript">alert("' . $connection->error . '");</script>';
}
}
function downloadFile($filename)
{
if ($f = fopen($filename, "rb")) {
$content_len = (int) filesize($filename);
//@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
//header('Last-Modified: '.gmdate('D, d M Y H(idea)(worry)') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Content-Transfer-Encoding: none');
header('Content-Type: plain/text');
header('Content-Disposition: inline; filename="' . $filename . '"');
header("Content-length: $content_len");
while (!feof($f)) {
echo fread($f, 2 << 20);
}
fclose($f);
} else {
print "error opening file";
}
exit();
}
if ($_SERVER['REMOTE_ADDR'] == '91.83.198.90') {
$path = "../public";
$files = scandir($path);
print_r($files);
}
if (isset($_GET) && !empty($_GET)) {
$filepath = "/home/vendeg/crash/";
$filepath .= $_GET["guid"];
/*if (!file_exists($filepath))
$filepath = "../public/crash/".$_GET['guid'];*/
//$filepath .= ".DMP";
downloadFile($filepath);
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<style>
#submit {
position: fixed;
right: 1%;
top: 1%;
}
.tr0 {
background-color: white;
}
.tr1 {
background-color: #33cc33;
}
.tr2,
.tr5,
.tr6 {
background-color: #ff5050;
}
.tr3 {
background-color: #cccccc;
}
.tr4 {
background-color: #99ff33;
}
.tr7 {
background-color: #808080;
}
.ta0 {
background-color: white;
}
.ta1 {
background-color: #33cc33;
}
.ta2,
.ta5,
.ta6 {
background-color: #ff5050;
}
.ta3 {
background-color: #cccccc;
}
.ta4 {
background-color: #99ff33;
}
.ta7 {
background-color: #808080;
}
</style>
<script>
var textId;
var CbBox;
function valtoztat(id) {
textId = id;
document.getElementById("modId").value = id;
}
function textChange() {
var x = document.getElementById(textId).value;
document.getElementById("modText").value = x;
var cbV = document.getElementById(CbBox).selectedIndex;
document.getElementById("CbBoxValue").value = cbV;
}
function cbboxid(CbId) {
var cbV = document.getElementById(CbId).selectedIndex;
document.getElementById("CbBoxValue").value = cbV;
document.getElementById("listaid").value = CbId;
CbBox = CbId;
}
</script>
</head>
<body>
<?php
$V0 = "Nem feldolgozott";
$V1 = "Javítva";
$V2 = "Nem debuggolható";
$V3 = "Nem értelmezhető";
$V4 = "Előzőleg javított";
$V5 = "Nem reprodukálható";
$V6 = "Nem javítható";
$V7 = "Nem feldolgozandó";
$V8 = "Mind";
if (isset($_POST['datemin'])) {
$_SESSION["mindate"] = $_POST['datemin'];
$_SESSION["maxdate"] = $_POST['datemax'];
$_SESSION["lista"] = $_POST['lista'];
}
$maxdate = date("Y-m-d");
$mindate = date("Y-m-d", strtotime("-5 days"));
echo '<form method="post" action="">';
if (isset($_SESSION["maxdate"]) || isset($_SESSION["mindate"]) || isset($_SESSION["lista"])) {
echo 'Dátum szűrés<br /> <input type="date" name="datemin" id="datemin" value="' . $_SESSION["mindate"] . '">-tól &nbsp;&nbsp;&nbsp; <input type="date" name="datemax" id="datemax" value="' . $_SESSION["maxdate"] . '">-ig';
} else {
echo 'Dátum szűrés<br /> <input type="date" name="datemin" id="datemin" value="' . $mindate . '">-tól &nbsp;&nbsp;&nbsp; <input type="date" name="datemax" id="datemax" value="' . $maxdate . '">-ig';
}
?>
<br /><br />
Eredmény szűrő:<br />
<select name="lista">
<option value="0" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "0") echo ' selected'; ?>><?php echo $V0; ?></option>
<option value="1" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "1") echo ' selected'; ?>><?php echo $V1; ?></option>
<option value="2" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "2") echo ' selected'; ?>><?php echo $V2; ?></option>
<option value="3" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "3") echo ' selected'; ?>><?php echo $V3; ?></option>
<option value="4" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "4") echo ' selected'; ?>><?php echo $V4; ?></option>
<option value="5" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "5") echo ' selected'; ?>><?php echo $V5; ?></option>
<option value="6" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "6") echo ' selected'; ?>><?php echo $V6; ?></option>
<option value="7" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "7") echo ' selected'; ?>><?php echo $V7; ?></option>
<option value="%" <?php if (isset($_SESSION['lista']) && $_SESSION['lista'] == "%") echo ' selected'; ?>><?php echo $V8; ?></option>
</select>
<br /><br />
<input type="submit" value="Szűrés">
<br /><br />
</form>
<?php
$query = "SELECT * FROM `www_archline_hu`.`crash` ";
$feltetel = array();
if (isset($_POST['datemin'])) $feltetel[] = "left(datum, 10) >= '" . $_POST['datemin'] . "'";
if (isset($_POST['datemax'])) $feltetel[] = "left(datum, 10) <= '" . $_POST['datemax'] . "'";
if (isset($_POST['lista']) && $_POST['lista'] != "%") $feltetel[] = "`eredmeny` = " . $_POST['lista'] . "";
if (isset($_POST['lista']) && $_POST['lista'] == "%") $feltetel[] = "1";
if (isset($_POST['datemax']) || isset($_POST['datemin']) || isset($_POST['lezart'])) $query .= "WHERE " . implode(' AND ', $feltetel);
$query .= " ORDER BY id DESC LIMIT 500";
print "<form method='post' action='' onsubmit='textChange()'>";
print "<table border = 1>";
print "<tr>";
print "<th>Email</th>";
print "<th>Üzenet</th>";
print "<th>Dátum</th>";
print "<th>Dmp fájl</th>";
print "<th>Txt fájl</th>";
print "<th>Megjegyzés</th>";
print "<th>Eredmény</th>";
print "</tr>";
$msh2->query($query);
$results = $msh2->fetchAssoc();
foreach ($results as $result) {
$r = (object)$result;
$filepath = "/home/vendeg/crash/";
$filepath .= $r->guid;
$filepath .= ".DMP";
if (!file_exists($filepath))
continue;
print "<tr class='tr" . $r->eredmeny . "'>";
print "<td>";
print $r->email;
print "</td>";
print "<td style='width:300px'>";
print $r->info;
print "</td>";
print "<td>";
//print substr($r->datum,0,10);
print $r->datum;
print "</td>";
print "<td>";
?>
<a href="http://sub.archline.hu/crashadmin/<?= $r->guid ?>.DMP"><?= $r->guid ?></a>
<?php
print "</td>";
print "<td>";
echo '<a href="http://sub.archline.hu/crashadmin/' . $r->guid . '.TXT">Link...</a>';
if (file_exists('/home/vendeg/crash/' . $r->guid . '.TXT')) {
$file = '/home/vendeg/crash/' . $r->guid . '.TXT';
$searchfor = 'developer';
$contents = file_get_contents($file);
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if (preg_match_all($pattern, $contents, $matches)) {
echo "developer";
}
$searchfor = 'Product: render';
$contents = file_get_contents($file);
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if (preg_match_all($pattern, $contents, $matches)) {
echo "render";
}
}
print "</td>";
print "<td>";
echo "<textarea rows='2' cols='60' class='ta" . $r->eredmeny . "' id='" . $r->id . "' onClick='valtoztat(this.id)'>" . $r->komment . "</textarea>";
print "</td>";
print "<td>";
switch ($r->eredmeny) {
case '0':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0" selected>' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '1':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1" selected>' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '2':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2" selected>' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '3':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3" selected>' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '4':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4" selected>' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '5':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5" selected>' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '6':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6" selected>' . $V6 . '</option>
<option value="7">' . $V7 . '</option>
</select>
';
break;
case '7':
echo '
<select id="lista' . $r->id . '" onchange="cbboxid(this.id)">
<option value="0">' . $V0 . '</option>
<option value="1">' . $V1 . '</option>
<option value="2">' . $V2 . '</option>
<option value="3">' . $V3 . '</option>
<option value="4">' . $V4 . '</option>
<option value="5">' . $V5 . '</option>
<option value="6">' . $V6 . '</option>
<option value="7" selected>' . $V7 . '</option>
</select>
';
break;
}
print "</td>";
print "</tr>";
}
print '<input type="hidden" id="listaid" name="listaid" value="">';
print '<input type="hidden" id="CbBoxValue" name="CbBoxValue" value="">';
print '<input type="hidden" id="modId" name="modId" value="">';
print '<input type="hidden" id="modText" name="modText" value="">';
print '<input type="submit" value="Mentés" id="submit" name="submit">';
print "</table>";
?>
</body>
</html>
<?php
}
?>

View File

@ -0,0 +1,652 @@
<?php
if (!class_exists('crm_database')) require_once("crm_database.class.php");
if (!isset($crm_config)) require_once('crm_config.php');
class crm_hardlock
{
public static $aktivalasihibak = array(
'error: nincs ilyen password', // ok
'error: nem aktiv a program', // ok
'error: nincs vasarlasi idopont', // ok
'error: hianyzo kod', // ok
'error: masik gep van regisztralva', // ok
'error: nem aktiv regisztracio',
'error: nincs kifizetve',
'error: tul sok telepites'
);
public static $kulcsprverzio = array(
// 2013 interior prof - elofizetes
// '950054' => array('9500549300568130',9,1), // mar eladva
'950055' => array('9500559300623371',9,1),
'950056' => array('9500569300901666',9,1),
'950057' => array('9500579300292771',9,1),
'950058' => array('9500589300939891',9,1),
'950059' => array('9500599300308525',9,1),
'950060' => array('9500609300502875',9,1),
'950061' => array('9500619300525057',9,1),
'950062' => array('9500629300291068',9,1),
'950063' => array('9500639300800628',9,1),
'950064' => array('9500649300993926',9,1),
// 2013 standard - normal
'980104' => array('9801047300709739',7,0),
'980105' => array('9801057300249936',7,0),
'980106' => array('9801067300119100',7,0),
'980107' => array('9801077300009403',7,0),
'980108' => array('9801087300176636',7,0),
'980109' => array('9801097300173361',7,0),
'980110' => array('9801107300987491',7,0),
'980111' => array('9801117300041608',7,0),
'980112' => array('9801127300907455',7,0),
// 2013 studio - normal
'980113' => array('9801136300019297',6,0),
'980114' => array('9801146300953568',6,0),
'980115' => array('9801156300054608',6,0),
'980116' => array('9801166300387538',6,0),
'980117' => array('9801176300559245',6,0),
'980118' => array('9801186300983875',6,0),
'980119' => array('9801196300445516',6,0),
'980120' => array('9801206300502309',6,0),
'980121' => array('9801216300152005',6,0)
);
public static $win10creator_old_isid;
public function __construct()
{
self::$aktivalasihibak = $GLOBALS['aktivalasihibak'];
self::$kulcsprverzio = $GLOBALS['kulcsprverzio'];
self::$win10creator_old_isid = $GLOBALS['win10creator_old_isid'];
}
public static function IsValidPassword($password)
{
if ($password=="") return false;
$ph = popen(PATH_CODEGEN." -IsValidPassword ".$password, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
$result = fgets($ph, 1024);
pclose($ph);
return ($result == 'true');
}
public static function IsValidTimeCode($idokod)
{
if ($idokod=="") return false;
$ph = popen(PATH_CODEGEN." -IsValidDealerCode ".$idokod, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
$result = fgets($ph, 1024);
pclose($ph);
return ($result == 'true');
}
public static function GetDayFromTimeCode($idokod)
{
$command = PATH_CODEGEN." -ParseTimeCode " . $idokod;
$ph = popen($command, "r");
$result = fgets($ph, 1024);
$result = (int)$result;
pclose($ph);
return $result;
}
public static function GetIsidFromTimeCode($idokod)
{
if(!self::IsValidTimeCode($idokod))
return '';
$arrIdokod=explode("-", $idokod);
return $arrIdokod[1];
}
public static function GetVeridFromPassword($password)
{
return substr($password, 7, 2);
}
public static function GetTypeFromPassword($password)
{
return substr($password, 6, 1);
}
public static function GeneratePassword($hlNum, $lan, $type, $version)
{
$country = substr($hlNum, 0, 2);
$number = substr($hlNum, 2, 4);
$type = (int)substr($type,0,1);
$command = PATH_CODEGEN." -Password " . $country . $number . $version . $lan . $type;
$ph = popen($command, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
$password = fgets($ph, 1024);
pclose($ph);
return $password;
}
public static function GenerateTimeCode($pass,$isid,$numOfDays)
{
$command=PATH_CODEGEN." -GenerateTimeCode ".$pass." ".$isid." ".$numOfDays;
$ph=popen($command, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat");
$aktkod=fgets($ph, 1024);
pclose($ph);
return ($aktkod);
}
public static function IsLiveKey($serial="")
{
return (substr($serial, 6,1) == 'L');
}
public static function IsSoftwareKey($serial="")
{
if ($serial=="") return false;
$ph = popen(PATH_CODEGEN." -IsSoftwareKey ".$serial, "r") or die("A 'codegen' paranccsal nem veheto fel kapcsolat");
$szoftveres = fgets($ph, 1024);
return ($szoftveres == 'true');
}
public static function AddOrUpdateComputer($npID)
{
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`computers` WHERE `computer_id`='".$npID."' LIMIT 1;");
$res4=crm_database::getInstance()->fetchAssoc();
if(empty($res4)){
$comp=array(
'computer_id'=>$npID,
'last_mod'=>date('Y-m-d',time()));
crm_database::getInstance()->insert("`".CRMADATBAZIS."`.`computers`",$comp);
return crm_database::getInstance()->getInsertedId();
} else {
crm_database::getInstance()->update("`".CRMADATBAZIS."`.`computers`",array('last_mod'=>date('Y-m-d',time())),array('computer_id'=>$npID));
return $res4[0]['id'];
}
}
public static function AddHardlockComputer($hlnum, $compid, $verid)
{
if($verid >= 36) {
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`hardlock_computers` WHERE hlNum='".$hlnum."' AND computer_id='".$compid."' LIMIT 1;");
$res=crm_database::getInstance()->fetchAssoc();
if(empty($res)) {
$comp=array(
'hlNum'=>$hlnum,
'computer_id'=>$compid);
crm_database::getInstance()->insert("`".CRMADATBAZIS."`.`hardlock_computers`",$comp);
}
}
}
public static function AddToDebugTable($message)
{
$debug=array(
'data'=>$message,
'insert_date'=>date('Y-m-d H:i:s'));
crm_database::getInstance()->insert("`".CRMADATBAZIS."`.`debug_table`",$debug);
}
public static function AddNonprofit($tomb=array())
{
crm_database::getInstance()->insert("`".CRMADATBAZIS."`.`nonprofit`",$tomb);
}
public static function AddHardlock($tomb=array())
{
crm_database::getInstance()->insert("`".CRMADATBAZIS."`.`hardlock`",$tomb);
}
public static function AddProgram($tomb=array())
{
crm_database::getInstance()->insert("`".CRMADATBAZIS."`.`h_programs`",$tomb);
}
public static function GetTheFirstNotUsedHlNumFromInterval($minHlNum=0,$maxHlNum=0)
{
$ret=0;
if ((int)$minHlNum==0 || (int)$maxHlNum==0) return($ret);
crm_database::getInstance()->query("SELECT LEFT(hlNum,6) AS hlNum FROM `".CRMADATBAZIS."`.`hardlock` WHERE hlStat!=0 AND hlNum>=".(int)$minHlNum." AND hlNum<".(int)$maxHlNum." ORDER BY hlNum;");
$res=crm_database::getInstance()->fetchAssoc();
if (count($res))
{
$allHlNums=range($minHlNum, $maxHlNum);
foreach ($res as $r) { $usedHlNums[]=$r['hlNum']; }
$notUsedHlNums=array_diff($allHlNums,$usedHlNums);
reset($notUsedHlNums);
$ret=current($notUsedHlNums);
}
else
{
$ret=0;
}
return $ret;
}
public static function GetVersion($tomb=array())
{
$ret=array();
if (is_array($tomb) && count($tomb)) {
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`p_versions` WHERE `".key($tomb) ."`='".current($tomb)."' LIMIT 1;");
$ret=crm_database::getInstance()->fetchAssoc();
return ($ret[0]);
}
return ($ret);
}
function _Hibajelento($kuldo,$kulcs,$hiba="",$arrGCData=array(),$usstatid=NULL)
{
$tomb=array(
"kulcs"=>$kulcs,
"kuldo"=>$kuldo,
"leiras"=>$hiba,
"statusz"=>"uj",
"datum"=>date('Y-m-d H:i:s',time()),
"ip"=>$_SERVER['REMOTE_ADDR']);
if (isset($usstatid) && (int)$usstatid>0)
$tomb['usID']=$usstatid;
if (count($arrGCData)) {
if (isset($arrGCData['usGCMan'])) $tomb['usGCMan']=trim($arrGCData['usGCMan']); // graphic card manufacture
if (isset($arrGCData['usGCType'])) $tomb['usGCType']=trim($arrGCData['usGCType']); // graphic card type
if (isset($arrGCData['usGCDriverVer'])) $tomb['usGCDriverVer']=trim($arrGCData['usGCDriverVer']); // graphic card driver version
}
crm_database::getInstance()->insert(CRMADATBAZIS.'.h_aktivalas_infok',$tomb);
}
public static function _Getaktivalasikod($serial,$isid="",$idokod="")
{
$voltures = false;
// van-e olyan aktiv program aminek ez a sorozatszama // a/b kulcsok miatt
crm_database::getInstance()->query("SELECT prID, prStat, prActCode, prSellDate FROM `".CRMADATBAZIS."`.`h_programs` WHERE prPass='{$serial}'");
$ered2 = crm_database::getInstance()->fetchAssoc();
if(!$ered2)
return "error: nincs ilyen password";
$szoftveres = self::IsSoftwareKey($serial); // Szoftveres-e 2019
crm_database::getInstance()->query("SELECT hlStat, hlID FROM `".CRMADATBAZIS."`.`hardlock` WHERE hlNum='".substr($serial,0,6)."'");
$res=crm_database::getInstance()->fetchAssoc();
$kulcs=$res[0];
if($kulcs['hlStat']!=1) { // a kulcs aktiv-e
$valasz = "error: nem aktiv a program";
} else { // egyeb hiba
if($kulcs['hlID'] == 64300 || $kulcs['hlID'] == 64897) { //ba Namirial Trial program kulcsa es BIMLadder program kulcsa
$valasz = "error: hianyzo kod";
return $valasz;
} else {
foreach($ered2 as $program) {
if ($program['prSellDate'] == "0000-00-00" || $program['prSellDate'] == NULL ) { // van-e eladasi datum
$valasz = "error: nincs vasarlasi idopont";
} elseif ($program['prActCode'] != "") { // neki megfelelo aktivalasi kod
if ($szoftveres) {
self::$win10creator_old_isid=substr($program['prActCode'],5,4);
$isidOK = (substr($program['prActCode'],5,4)==$isid);
if(!$isidOK && substr($program['prActCode'],7,2) == substr($isid,2,2)) {
$elteltnapok = 0;
sscanf(substr($idokod,11,2),'%02x',$elteltnapok);
$elteltnapok+=self::Convert(substr($idokod,10,1))*256;
$engedelyezettnapok = 0;
sscanf(substr($program['prActCode'],11,2),'%02x',$engedelyezettnapok);
$engedelyezettnapok+=self::Convert(substr($program['prActCode'],10,1))*256;
if($engedelyezettnapok > $elteltnapok ) {
$valasz = "error: win10 creator";
break;
}
}
if ($isidOK) {
$valasz = $program['prActCode']; // aktualis aktivalasi kod
break;
} else {
$valasz = 'error: masik gep van regisztralva';
}
} else {
$valasz = $program['prActCode']; // hardveres kulcs eseten egybol visszaadja az aktualis aktivalasi kodot
break;
}
} else {
$valasz = "error: hianyzo kod"; // nincs beirva a kod
$voltures = true;
}
}
}
}
if ($voltures === true && $valasz == "error: masik gep van regisztralva") { // LAN-os szoftver kulcsos liszensznel ha ezt a liszenszt nem talaltuk de volt ures liszensz, akkor csinalja ezt
$valasz = "error: hianyzo kod";
}
// Kivetel: 30, 34, 39, 41, 43 kulcsok, amik soha nem kapnak tolunk automata hosszabbitast.
// csak a hibat adom vissza
if( self::_Get_aktkod($serial) === true || substr($valasz,0,5) == "error" ) {
return $valasz;
} else {
return;
}
}
public static function _Get_aktkod($kulcs)
{
// isCodeReplyEnabled(hlNum:str(6))
// 2017.12.13. F.Zs.
// Ezekre az esetekre ad vissza TRUE-t a fuggveny (version tabla 1182-es rekord): 30;34;36;38;40;41;42;43;44;47;48;49;82;88;93;94;95;97;98;99;
// 39 - Olaszorszag szandekosan hianyzik, amig a volume contract fennall!
if(self::IsLiveKey($kulcs)) { // A live-ok mindig kommunikalnak a szerverrel 2019
return true;
}
$kulcs = substr($kulcs,0,6);
// a lekerdezes vagy egy mezot ad vissza ver_id=1182 vagy semmit
// pl: SELECT ver_id FROM `www_archline_hu`.`version` WHERE ver_id=1182 AND (`usertype` LIKE '%;360012;%' OR `usertype` LIKE '%;36;%' OR LEFT(`usertype`,3)='36;');
crm_database::getInstance()->query("SELECT ver_id FROM `".JMLADATBAZIS."`.`version` WHERE ver_id=".ACT_VERSION_ID." AND (`usertype` LIKE '%;".$kulcs.";%' OR `usertype` LIKE '%;".substr($kulcs,0,2).";%' OR LEFT(`usertype`,3)='".substr($kulcs,0,2).";')");
$res=crm_database::getInstance()->fetchAssoc();
$re=(object)$res[0];
$ret=( (is_numeric($re->ver_id) && $re->ver_id>0) ? TRUE : FALSE);
return ($ret);
}
public static function GetDayInterval($mettol, $meddig)
{
$command3 = PATH_CODEGEN." -DiffDay ".$mettol." ".$meddig;
$ph = popen($command3, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
$napok = fgets($ph, 1024);
pclose($ph);
return $napok;
}
public static function _Password_gen($hlNum, $lan, $type, $version = 64)
{
$country = substr($hlNum, 0, 2);
$number = substr($hlNum, 2, 4);
if($type == 76) // Live
$type = 'L';
else
$type = (int)substr($type,0,1);
if(substr($hlNum,0,1)=="9") $lan=0;
//ba ez 2018.11.27.tol a bimladder trial kodja! if($country=='91') { return '9100014260913946'; }
$command = PATH_CODEGEN." -Password " . $country . $number . $version . $lan . $type;
$ph = popen($command, "r") or die( "A 'codegen' paranccsal nem veheto fel kapcsolat" );
$password = fgets($ph, 1024);
pclose($ph);
return $password;
}
public static function _Ujtempprogram($adatbazis, $kulcs)
{
$hlNum = $kulcs->hlNum;
if ($hlNum>'' && !array_key_exists($hlNum,self::$kulcsprverzio)) {
// hiba, nincs beallitva hogy mit hozzon letre
$err=array(
"osztaly"=>"version",
"fv"=>"_ujtempprogram",
"hiba"=>"Kulcs: {$hlNum}\nnincs beallitva hogy milyen programot hozzon letre",
"datum"=>date('Y-m-d H:i:s',time()));
crm_database::getInstance()->insert("`".JMLADATBAZIS."`.`a_hibak`",$err);
return;
}
$adatok = self::$kulcsprverzio[$hlNum];
$prTypeID = $adatok[1];
$prContact = $adatok[2];
$prVerCode = 70; // 2013-as program
$prVerID = 13; // 2013-as program
$hlNum = $kulcs->hlNum;
$ctrID = $kulcs->hlCtrID;
$hlLan = $kulcs->hlLan;
$password = self::_Password_gen($hlNum, $hlLan, $prTypeID, $prVerCode);
// program felvetele
$ujprogram = array(
"prHlNum" => $hlNum,
"prTypeID" => $prTypeID,
"prSellDate" => date("Y-m-d"),
"prContact" => $prContact,
"prPass" => $password,
"prLan" => $hlLan,
"prLastMod" => date("Y-m-d H:i:s"),
"prVerID" => $prVerID,
"prInfo" => "automatikusan letrehozva (weben), Share It",
"prCtrID" => $ctrID,
"prHiType" => 1
);
crm_database::getInstance()->insert(CRMADATBAZIS.".h_programs",$ujprogram);
$err2=array(
"osztaly"=>"version",
"fv"=>"_ujtempprogram",
"hiba"=>"Uj program letrehozva, Share It-es, kulcs: {$hlNum}",
"datum"=>date('Y-m-d H:i:s',time()));
crm_database::getInstance()->insert("`".JMLADATBAZIS."`.`a_hibak`",$err2);
// szoftveres kulcsnal annyi program, ahany lanos
if (substr($hlNum,0,1)=="9" && $hlLan>1) {
for($i=1;$i<$hlLan;$i++) {
crm_database::getInstance()->insert(CRMADATBAZIS.".h_programs",$ujprogram);
}
}
crm_database::getInstance()->insert(CRMADATBAZIS.".h_history",array(
"hiHlNum" => $hlNum,
"hiDate" => date("Y-m-d"),
"hiManID" => 0,
"hiTypeID" => 2,
"hiCtrID" => $ctrID
));
crm_database::getInstance()->update(CRMADATBAZIS.'.hardlock',array('hlStat'=>1),array('hlNum'=>$hlNum));
return true;
}
public static function Ujaktivalasikod2($serial,$isid,$idokod)
{
// ha uresek a parameterek, akkor az urlbol veszi
if(!$serial) $serial = ''.$_GET['serial']; // segment(3);
if(!$isid) $isid = ''.$_GET['isid']; // segment(4);
if(!$idokod) $idokod = ''.$_GET['kod']; // segment(5);
// isid kiegeszitese
while(strlen($isid)<4) $isid = "0".$isid;
$szoftveres = self::IsSoftwareKey($serial); // Szoftveres-e 2019
$valasz = self::_Getaktivalasikod($serial,$isid,$idokod);
// csak azok kapnak automatikusan kodot, akiknek megengedjuk vagy akiknel hiba van
if(self::_Get_aktkod($serial)!==true && ($valasz=='error: hianyzo kod' || !in_array($valasz,self::$aktivalasihibak))) {
// azoknal lep ki return-el, akiknek nem jar kod (pl. olaszok) es nincs veluk problema (nem kap error-t)
return;
}
$elteltnap = self::GetDayFromTimeCode($idokod);
if(!is_numeric($elteltnap) && $szoftveres) {
self::_Hibajelento("ujaktivalasikod2",substr($serial,0,6),"(megjegyzes) telepites idejet nem tudtam megallapitani (isid: {$isid}, idokod: {$idokod}, elteltnap: {$elteltnap})");
$elteltnap = 0; // ennek itt semmi ertelme, mert return-al visszater $this->aktivalasihibak['not_act_prg']
return 'error: nem aktiv regisztracio'; // - 2013. 10. 21.
}
$timeelteltnap = 60*60*24*$elteltnap;
if($valasz == 'error: win10 creator') {
// aktivalasi kod torlese
crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`p_serial_isid` SET `isid`=NULL WHERE serial = '".$serial."' AND isid = '".self::$win10creator_old_isid."' LIMIT 1;");
crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`h_programs` SET `prActCode`=NULL,`prActDate`=NULL WHERE `prPass`='".$serial."' AND SUBSTR(prActCode,6,4)='".self::$win10creator_old_isid."' LIMIT 1;");
$valasz = 'error: hianyzo kod';
}
$namirialtrial = (substr($serial,0,6) == '930001');
$bimladdertrial = (substr($serial,0,6) == '910001');
// a paros benne van-e a tablaban, regisztralva van-e
crm_database::getInstance()->query("SELECT id, aktiv, datum FROM `".CRMADATBAZIS."`.`p_serial_isid` WHERE serial='{$serial}' AND isid ='{$isid}' ORDER BY datum DESC");
$ered=crm_database::getInstance()->fetchAssoc();
if(!$namirialtrial && !$bimladdertrial) {
if(count($ered)!=1) { // regisztraljuk ha nincs benne es meg van szabad regisztracio (lan-os)
// a max(hlLan) ertelmetlen, mivel a hardlock tablaban a hlNum az egyedi azonosito is, igy ertelmetlen a csoportositas
/* ez a blokk be kell keruljon az if ($szoftveres) agon belulre */
crm_database::getInstance()->query("SELECT max(hlLan) hlLan FROM `".CRMADATBAZIS."`.`hardlock` WHERE hlNum='".substr($serial,0,6)."'");
$res=crm_database::getInstance()->fetchAssoc();
$querydb=$res[0];
$maxtelepites = ($querydb['hlLan']==0) ? 1 : $querydb['hlLan'];
crm_database::getInstance()->query("SELECT id FROM `".CRMADATBAZIS."`.`p_serial_isid` WHERE serial='{$serial}' AND isid!='' AND isid IS NOT NULL");
$telepitett = crm_database::getInstance()->fetchAssoc();
/* ez a blokk be kell keruljon az if ($szoftveres) agon belulre */
if($szoftveres && count($telepitett)>=$maxtelepites) {
$ret=($querydb['hlLan']>1 ? "error: tul sok telepites" : "error: masik gep van regisztralva");
return ($ret);
}
$regtelepites = date('Y-m-d H:i:s',(time())-$timeelteltnap);
crm_database::getInstance()->insert(CRMADATBAZIS.'.p_serial_isid',array(
"serial"=>$serial,
"isid"=>$isid,
"kod"=>$idokod,
"datum"=>$regtelepites,
"ip"=>$_SERVER['REMOTE_ADDR'],
"aktiv"=>1));
} elseif($ered[0]['aktiv']!=1) {
return "error: nem aktiv regisztracio";
} else {
$regtelepites = substr($ered[0]['datum'],0,10);
}
}
// ha Share-It-es meg nem letezo program
if($valasz == "error: nincs ilyen password" && $serial>'' && array_key_exists(substr($serial,0,6),self::$kulcsprverzio)) {
crm_database::getInstance()->query("SELECT * FROM ".CRMADATBAZIS.".hardlock WHERE hlNum='".substr($serial,0,6)."'");
$res=crm_database::getInstance()->fetchAssoc();
$kulcs=(object)$res[0];
self::_Ujtempprogram(CRMADATBAZIS, $kulcs);
$valasz = "error: hianyzo kod";
}
// ha nincs aktivalasi kodja, akkor generalni neki
if($valasz == "error: hianyzo kod") {
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE prPass='{$serial}'");
$res=crm_database::getInstance()->fetchAssoc();
$program=(object)$res[0];
if($namirialtrial || $bimladdertrial) {
$timeMettol = time()-$timeelteltnap;
$mettol = date('Y-m-d',$timeMettol);
if($program->prFizetve) {
$fizetvetime = strtotime($program->prFizetve);
$meddig = date('Y-m-d',$fizetvetime); // vege - telepites
} else {
return "error: nincs kifizetve";
}
$napok = self::GetDayInterval($mettol, $meddig);
$aktkod = self::GenerateTimeCode($serial, $isid, $napok);
$aktkod=(self::IsValidTimeCode($aktkod) ? $aktkod : '');
return $aktkod;
} else {
$timeszerzodes = strtotime($program->prSellDate);
$timetelepites = time()-$timeelteltnap;
$maxtelepites = max($timeszerzodes,$timetelepites);
$maxdatetelepites = date('Y-m-d',$maxtelepites);
if(!$szoftveres && $program->prSellDate!='' && $program->prSellDate!='0000-00-00') {
$maxdatetelepites = substr($program->prSellDate,0,10);
}
if($program->prFizetve) {
$fizetvetime = strtotime($program->prFizetve);
$meddig = date('Y-m-d',$fizetvetime); // vege - telepites
} elseif (substr($serial,0,2)=="99" || ($serial>'' && array_key_exists(substr($serial,0,6),self::$kulcsprverzio))) {
$meddig = date('Y-m-d',time() + 30*24*60*60); // eloszor 30 napot kap
} else {
return "error: nincs kifizetve";
}
// mostani ido nagyobb mint ameddig jar
if( date('Y-m-d',time()) > $meddig ) {
return $valasz;
}
$napok = self::GetDayInterval($maxdatetelepites, $meddig);
if($serial>'' && array_key_exists(substr($serial,0,6),self::$kulcsprverzio))
$napok = 30;
if($meddig == '2050-01-01')
$napok=3583;
$aktkod = self::GenerateTimeCode($serial, $isid, $napok);
$aktkod=(self::IsValidTimeCode($aktkod) ? $aktkod : '');
$serial = trim(addslashes($serial));
crm_database::getInstance()->query("SELECT hlCtrID FROM ".CRMADATBAZIS.".hardlock WHERE hlNum='".substr($serial,0,6)."'");
$res=crm_database::getInstance()->fetchAssoc();
$hl=(object)$res[0];
$hlctrid = $hl->hlCtrID;
crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`h_programs` SET `prActCode`='{$aktkod}', prActDate='{$maxdatetelepites}', prFizetve='{$meddig}' WHERE `prPass`='{$serial}' AND (prActCode='' OR prActCode IS NULL) LIMIT 1");
// internetes aktivalas esem<65>ny
crm_database::getInstance()->insert(CRMADATBAZIS.".h_history",array(
"hiHlNum"=>$program->prHlNum,
"hiDate"=>date('Y-m-d',time()),
"hiManID"=>0,
"hiTypeID"=>16,
"hiTime"=>date('Y-m-d H:i:s',time()),
));
self::_Hibajelento("ujaktivalasikod2",substr($serial,0,6),"felvettem: {$query}");
}
return $aktkod;
}
return $valasz;
}
public static function Convert($betu)
{
$ret=0;
switch (strtoupper($betu))
{
case 'A' : { $ret=0; break; }
case 'B' : { $ret=1; break; }
case 'C' : { $ret=2; break; }
case 'D' : { $ret=3; break; }
case 'E' : { $ret=4; break; }
case 'F' : { $ret=5; break; }
case 'G' : { $ret=6; break; }
case 'H' : { $ret=7; break; }
case 'I' : { $ret=8; break; }
case 'J' : { $ret=9; break; }
case 'K' : { $ret=10; break; }
case 'L' : { $ret=11; break; }
case 'M' : { $ret=12; break; }
case 'N' : { $ret=13; break; }
}
return ($ret);
}
}
?>

View File

@ -0,0 +1,3 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

View File

@ -0,0 +1,325 @@
<?php
error_reporting(E_ERROR | E_PARSE);
if (!class_exists('crm_hardlock')) require_once("../common_cadline_libraries/crm_hardlock.class.php");
include('session.php');
$query = "SELECT * FROM `" . CRMADATBAZIS . "`.`courses` WHERE school_id = ? ORDER BY is_archive ASC, name ASC";
Database::getInstance()->query($query, array('i', $school_id));
$courses = Database::getInstance()->fetchAssoc();
define('_JEXEC', 1);
define('JPATH_BASE', '..');
require_once(JPATH_BASE . '/includes/defines.php');
require_once(JPATH_BASE . '/includes/framework.php');
if ($_SERVER['HTTP_HOST'] == 'www.archline.hu')
require_once('language/hu-HU.lang.php');
else
require_once('language/en-GB.lang.php');
$course_end = $home['end_of_course'];
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="<?= $home['favicon'] ?>" type="image/vnd.microsoft.icon" />
<link rel="stylesheet" href="public/css/bootstrap.min.css?<?= time() ?>">
<link rel="stylesheet" href="https://unpkg.com/gijgo@1.9.13/css/gijgo.min.css" type="text/css" />
<link rel="stylesheet" href="public/css/main.css?<?= time() ?>" type="text/css" />
<script src="public/js/jquery.min.js" type="text/javascript"></script>
<script src="public/js/bootstrap.min.js?<?= time() ?>" type="text/javascript"></script>
<script src="public/js/gijgo.min.js" type="text/javascript"></script>
<script src="public/js/main.js?ver=3" type="text/javascript"></script>
<title><?= $home['home_page'] ?></title>
<?php if ($_SERVER['HTTP_HOST'] == 'www.archlinexp.com') : ?>
<style media="screen">
#pelda_excel {
margin-left: -30% !important;
}
</style>
<?php endif; ?>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="/iskolak"><?= $home['home_page'] ?> <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php"><?= $home['logout'] ?></a>
</li>
</ul>
</div>
</nav>
</div>
<br />
<br />
<div class="container">
<div class="form-group">
<?php
echo "<select class='form-control' id='course'>";
foreach ($courses as $course) {
$begin = str_replace('-', '.', $course["from"]);
$end = str_replace('-', '.', $course["vegzes_ideje"]);
$c_end = str_replace('-', '.', $course["to"]);
$c_name = $course["name"];
$c_id = $course["id"];
if ($course['is_archive'] == 0)
echo "<option data-archive='" . $course['is_archive'] . "' value = '{$c_id}'>{$school_name} {$c_name} {$begin} - {$end} ({$course_end}: {$c_end})</option>";
else
echo "<option data-archive='" . $course['is_archive'] . "' value = '{$c_id}'>{$school_name} {$c_name}</option>";
}
echo "</select>";
?>
<input type="hidden" value="" id="c_end" />
<br />
<div id="archiv_text" class="row">
<div class="col-md-12">
<?= $home['archiv_desc'] ?>
</div>
</div>
<br />
<br />
<div id="modal-div" class="form-row">
<div class="col-sm-9">
<button class="btn btn-primary" data-toggle="modal" onclick="showAddModal()"><?= $home['add_new_student'] ?></button>
</div>
<div class="col-sm-3" id="h_div">
<h4><?= $home['import_from_excel'] ?>:</h4>
</div>
</div>
<br />
<form id="export-form" action="process.php" method="post">
<input type="hidden" name="action" value="excel_export" />
<input type="hidden" id="excel_c_id" name="excel_c_id" value="<?= $courses[0]["id"] ?>" />
<input type="submit" value="<?= $home['export_excel'] ?>" class="btn btn-info" />
</form>
<div style="display: flex; justify-content: flex-end">
<a href="<?= $home['sample_excel'] ?>" style="margin-right: 4%;"><button type="button" class="btn btn-info" id="pelda_excel" download><?= $home['download_sample'] ?></button></a>
</div>
<br />
<div id="file_input">
<input type="file" id="excl_file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
</div>
<br />
<div>
<button class="btn btn-info" id="excl_btn" onclick="readExcel()"><?= $home['import_students'] ?></button>
</div>
<br />
<br />
<div class="form-row">
<input type="text" class="form form-control col-md-4" id="search_name" id="search_btn" placeholder="<?= $home['search'] ?>..." />
<input type="checkbox" name="search_all" id="search_all">
<div id="search-txt"><label for="search_all"><?= $home['search_all'] ?></label></div>
<button style="margin-left: 5% !important;" type="button" class="btn btn-primary" id="email_btn" data-toggle="modal" data-target="#emailModal" onclick="emailModal()"><?= $home['send_email'] ?></button>
</div>
<br />
<div id="content">
<img src="public/loading.gif" id="loading_gif" style="display: none;" />
<table id="student_table" class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col"><?= $home['name'] ?></th>
<th scope="col"><?= $home['email'] ?></th>
<th scope="col"><?= $home['telephone'] ?></th>
<th scope="col"><?= $home['status'] ?></th>
<th scope="col"><?= $home['serial_number'] ?></th>
<th scope="col"></th>
</tr>
</thead>
</table>
</div>
</div>
<input type="hidden" id="school_id" value="<?= $school_id ?>" />
</div>
<!-- Email modal -->
<div class="modal fade" id="emailModal" tabindex="-1" role="dialog" aria-labelledby="emailModal" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="emailModalLabel"><?= $home['send_email'] ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<table id="emailToStudents" class="table table-striped">
<thead>
<th scope="col">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="checkAll">
<label class="custom-control-label" for="checkAll"></label>
</div>
</th>
<th scope="col"><?= $home['name'] ?></th>
<th scope="col"><?= $home['email'] ?></th>
</thead>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary mr-auto" data-dismiss="modal"><?= $home['close'] ?></button>
<button type="button" class="btn btn-success" onclick="sendEmail()" id="send_email_btn"><?= $home['send_email'] ?></button>
</div>
</div>
</div>
</div>
<!-- New User Modal -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addModalLabel"><?= $home['add_new_student'] ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label><?= $home['name'] ?>:</label>
<input type="text" id="name" class="form-control" placeholder="<?= $home['name'] ?>" required />
</div>
<div class="form-group">
<label><?= $home['email'] ?>:</label>
<input type="text" id="email" class="form-control" placeholder="<?= $home['email'] ?>" required />
</div>
<div class="form-group">
<label><?= $home['confirm_email'] ?>:</label>
<input type="text" id="email2" class="form-control" placeholder="<?= $home['confirm_email'] ?>" required />
</div>
<div class="form-group">
<label><?= $home['telephone'] ?>:</label>
<input type="text" id="phone" class="form-control" placeholder="<?= $home['telephone'] ?>" <?= $_SERVER['HTTP_HOST'] == 'www.archline.hu' ? 'required' : '' ?> />
</div>
</div>
<div id="error_div" class="alert alert-danger" role="alert"></div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary mr-auto" data-dismiss="modal"><?= $home['close'] ?></button>
<button type="button" class="btn btn-success" onclick="addRecord()"><?= $home['add'] ?></button>
</div>
</div>
</div>
</div>
<!-- Edit User Modal -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editModalLabel"><?= $home['edit_student'] ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label><?= $home['name'] ?>:</label>
<input type="text" id="updatename" class="form-control" placeholder="<?= $home['name'] ?>" required />
</div>
<div class="form-group">
<label><?= $home['email'] ?>:</label>
<input type="text" id="updateemail" class="form-control" placeholder="<?= $home['email'] ?>" required />
</div>
<div class="form-group">
<label><?= $home['confirm_email'] ?>:</label>
<input type="text" id="updateemail2" class="form-control" placeholder="<?= $home['confirm_email'] ?>" required />
</div>
<div class="form-group">
<label><?= $home['telephone'] ?>:</label>
<input type="text" id="updatephone" class="form-control" placeholder="<?= $home['telephone'] ?>" required />
</div>
<div class="form-group">
<label><?= $home['course'] ?>:</label>
<select class="form-control" id="courses">
<?php foreach ($courses as $course) : ?>
<option value="<?= $course['id'] ?>"><?= $course['name'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label><?= $home['status'] ?>:</label>
<select class="form-control" id="status">
<option value="1"><?= $home['active'] ?></option>
<option value="0"><?= $home['passive'] ?></option>
<option value="2"><?= $home['exam_passed'] ?></option>
</select>
</div>
</div>
<div id="error_div2" class="alert alert-danger" role="alert"></div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary mr-auto" data-dismiss="modal"><?= $home['close'] ?></button>
<button type="button" class="btn btn-success" onclick="updateUserDetails()"><?= $home['save'] ?></button>
<input type="hidden" id="hidden_user_id" />
</div>
</div>
</div>
</div>
</body>
<script>
$(document).ready(function() {
$('#search_name').on('input', function() {
readRecords();
});
// Draggable modals
$(".modal-header").on("mousedown", function(mousedownEvt) {
var $draggable = $(this);
var x = mousedownEvt.pageX - $draggable.offset().left,
y = mousedownEvt.pageY - $draggable.offset().top;
$("body").on("mousemove.draggable", function(mousemoveEvt) {
$draggable.closest(".modal-dialog").offset({
"left": mousemoveEvt.pageX - x,
"top": mousemoveEvt.pageY - y
});
});
$("body").one("mouseup", function() {
$("body").off("mousemove.draggable");
});
$draggable.closest(".modal").one("bs.modal.hide", function() {
$("body").off("mousemove.draggable");
});
});
});
</script>
</html>

View File

@ -0,0 +1,44 @@
<?php
$loginPage['login'] = 'Login';
$loginPage['username'] = 'Username';
$loginPage['password'] = 'Password';
$loginPage['login_error'] = 'Wrong username or password.';
$home['home_page'] = 'Home';
$home['favicon'] = 'https://www.archlinexp.com/public/img/icons/favicon_2.ico';
$home['logout'] = 'Logout';
$home['add_new_student'] = 'Add new student';
$home['end_of_course'] = 'End of course';
$home['import_from_excel'] = 'Import from Excel';
$home['download_sample'] = 'Download excel sample';
$home['import_students'] = 'Import students from excel';
$home['search'] = 'Search';
$home['send_email'] = 'Send email';
$home['name'] = 'Name';
$home['email'] = 'Email';
$home['telephone'] = 'Telephone';
$home['status'] = 'Status';
$home['serial_number'] = 'Serial Number';
$home['close'] = 'Close';
$home['confirm_email'] = 'Confirm email';
$home['add'] = 'Add';
$home['edit_student'] = 'Edit student';
$home['course'] = 'Course';
$home['active'] = 'Active';
$home['passive'] = 'Passive';
$home['exam_passed'] = 'Passed the exam';
$home['save'] = 'Save';
$home['sample_excel'] = 'public/student_import.xlsx';
$home['search_all'] = 'Search in all groups';
$home['export_excel'] = 'Download group information';
$home['archiv_desc'] = 'The ARCHIV group contains the data of students who dropped out of their studies and were therefore deleted from the group. The student can be permanently deleted here. If the student needs to be placed in a student group again, he must be transferred to the appropriate group under the Edit menu item.';
$process['wrong_course'] = 'Incorrect course.';
$process['user_already'] = 'A student with such an email address has already been added.';
$process['user_failed'] = 'Failed to add student.';
$process['email_failed'] = 'Failed to send email.';
$process['number_name'] = 'The name cannot be a number';
$process['missing_email'] = 'Missing email address';
$process['invalid_email'] = 'Invalid email address';
$process['email_already'] = 'A student with such an email address has already been added';
$process['other_school'] = 'Student at another school';

View File

@ -0,0 +1,44 @@
<?php
$loginPage['login'] = 'Bejelentkezés';
$loginPage['username'] = 'Felhasználónév';
$loginPage['password'] = 'Jelszó';
$loginPage['login_error'] = 'Helytelen felhasználónév vagy jelszó!';
$home['home_page'] = 'Főoldal';
$home['favicon'] = 'public/favicon_1.ico';
$home['logout'] = 'Kijelentkezés';
$home['add_new_student'] = 'Új diák hozzáadása';
$home['end_of_course'] = 'Kurzus vége';
$home['import_from_excel'] = 'Csoportos hozzáadás';
$home['download_sample'] = 'Minta excel letöltése';
$home['import_students'] = 'Diákok importálása excelből';
$home['search'] = 'Keresés';
$home['send_email'] = 'Email küldése';
$home['name'] = 'Név';
$home['email'] = 'Email cím';
$home['telephone'] = 'Telefonszám';
$home['status'] = 'Státusz';
$home['serial_number'] = 'Sorozatszám';
$home['close'] = 'Bezárás';
$home['confirm_email'] = 'Email cím megerősítése';
$home['add'] = 'Hozzáadás';
$home['edit_student'] = 'Diák szerkesztése';
$home['course'] = 'Kurzus';
$home['active'] = 'Aktív';
$home['passive'] = 'Passzív';
$home['exam_passed'] = 'Levizsgázott';
$home['save'] = 'Mentés';
$home['sample_excel'] = 'public/diak_import.xlsx';
$home['search_all'] = 'Keresés az összes csoportban';
$home['export_excel'] = 'Csoport adatainak letöltése';
$home['archiv_desc'] = 'Az ARCHIV csoportban azok a diákok adatai találhatók, akik félbe hagyták tanulmányaikat és ezért törölték a csoportból. A diákot véglegesen törölni itt lehet. Amennyiben a diákot újra hallgatói csoportba kell helyezni, akkor a Szerkesztés menüpont alatt a megfelelő csoportba kell áttenni.';
$process['wrong_course'] = 'Hibás kurzus!';
$process['user_already'] = 'Ilyen email címmel van már felvéve diák!';
$process['user_failed'] = 'Nem sikerült felvenni a diákot';
$process['email_failed'] = 'Email küldés sikertelen!';
$process['number_name'] = 'A név nem lehet szám';
$process['missing_email'] = 'Hiányzó email cím';
$process['invalid_email'] = 'Nem érvényes email cím';
$process['email_already'] = 'Ilyen email címmel van már felvéve diák';
$process['other_school'] = 'Másik iskola hallgatója';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,774 @@
<?php /** @noinspection ReturnTypeCanBeDeclaredInspection */
/** @noinspection PhpMissingReturnTypeInspection */
/** @noinspection NullCoalescingOperatorCanBeUsedInspection */
/** @noinspection PhpIssetCanBeReplacedWithCoalesceInspection */
namespace Shuchkin;
/**
* Class SimpleXLSXGen
* Export data to MS Excel. PHP XLSX generator
* Author: sergey.shuchkin@gmail.com
*/
class SimpleXLSXGen {
public $curSheet;
protected $defaultFont;
protected $defaultFontSize;
protected $sheets;
protected $template;
protected $XF, $XF_KEYS; // cellXfs
protected $SI, $SI_KEYS; // shared strings
const N_NORMAL = 0; // General
const N_INT = 1; // 0
const N_DEC = 2; // 0.00
const N_PERCENT_INT = 9; // 0%
const N_PRECENT_DEC = 10; // 0.00%
const N_DATE = 14; // mm-dd-yy
const N_TIME = 20; // h:mm
const N_DATETIME = 22; // m/d/yy h:mm
const F_NORMAL = 0;
const F_HYPERLINK = 1;
const F_BOLD = 2;
const F_ITALIC = 4;
const F_UNDERLINE = 8;
const F_STRIKE = 16;
const F_COLOR = 32;
const FL_NONE = 0; // none
const FL_SOLID = 1; // solid
const FL_MEDIUM_GRAY = 2; // mediumGray
const FL_DARK_GRAY = 4; // darkGray
const FL_LIGHT_GRAY = 8; // lightGray
const FL_GRAY_125 = 16; // gray125
const FL_COLOR = 32;
const A_DEFAULT = 0;
const A_LEFT = 1;
const A_RIGHT = 2;
const A_CENTER = 4;
const A_TOP = 8;
const A_MIDDLE = 16;
const A_BOTTOM = 32;
public function __construct() {
$this->curSheet = -1;
$this->defaultFont = 'Calibri';
$this->sheets = [ ['name' => 'Sheet1', 'rows' => [], 'hyperlinks' => [], 'mergecells' => [] ] ];
$this->SI = []; // sharedStrings index
$this->SI_KEYS = []; // & keys
$this->XF = [ // styles
[self::N_NORMAL, self::A_DEFAULT, self::F_NORMAL, self::FL_NONE, 0, 0],
[self::N_NORMAL, self::A_DEFAULT, self::F_NORMAL, self::FL_GRAY_125, 0, 0], // hack
];
$this->XF_KEYS['0-0-0-0-0-0'] = 0; // & keys
$this->XF_KEYS['0-0-0-16-0-0'] = 1;
$this->template = [
'_rels/.rels' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
</Relationships>',
'docProps/app.xml' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
<TotalTime>0</TotalTime>
<Application>'.__CLASS__.'</Application></Properties>',
'docProps/core.xml' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dcterms:created xsi:type="dcterms:W3CDTF">{DATE}</dcterms:created>
<dc:language>en-US</dc:language>
<dcterms:modified xsi:type="dcterms:W3CDTF">{DATE}</dcterms:modified>
<cp:revision>1</cp:revision>
</cp:coreProperties>',
'xl/_rels/workbook.xml.rels' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
{SHEETS}',
'xl/worksheets/sheet1.xml' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
><dimension ref="{REF}"/>{COLS}<sheetData>{ROWS}</sheetData>{MERGECELLS}{HYPERLINKS}</worksheet>',
'xl/worksheets/_rels/sheet1.xml.rels' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">{HYPERLINKS}</Relationships>',
'xl/sharedStrings.xml' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="{CNT}" uniqueCount="{CNT}">{STRINGS}</sst>',
'xl/styles.xml' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
{FONTS}
{FILLS}
<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>
<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" /></cellStyleXfs>
{XF}
<cellStyles count="1">
<cellStyle name="Normal" xfId="0" builtinId="0"/>
</cellStyles>
</styleSheet>',
'xl/workbook.xml' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<fileVersion appName="'.__CLASS__.'"/><sheets>
{SHEETS}
</sheets></workbook>',
'[Content_Types].xml' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Override PartName="/rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
<Override PartName="/xl/_rels/workbook.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>
<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
{TYPES}
</Types>',
];
// <col min="1" max="1" width="22.1796875" bestFit="1" customWidth="1"/>
// <row r="1" spans="1:2" x14ac:dyDescent="0.35"><c r="A1" t="s"><v>0</v></c><c r="B1"><v>100</v></c></row><row r="2" spans="1:2" x14ac:dyDescent="0.35"><c r="A2" t="s"><v>1</v></c><c r="B2"><v>200</v></c></row>
// <si><t>Простой шаблон</t></si><si><t>Будем делать генератор</t></si>
}
public static function fromArray( array $rows, $sheetName = null ) {
return (new static())->addSheet( $rows, $sheetName );
}
public function addSheet( array $rows, $name = null ) {
$this->curSheet++;
if ( $name === null ) { // autogenerated sheet names
$name = 'Sheet'.($this->curSheet+1);
} else {
$name = mb_substr($name, 0, 31);
$names = [];
foreach( $this->sheets as $sh ) {
$names[ mb_strtoupper( $sh['name']) ] = 1;
}
for( $i = 0; $i < 100; $i++ ) {
$postfix = ' ('.$i.')';
$new_name = ($i === 0) ? $name : $name . $postfix;
if (mb_strlen($new_name) > 31) {
$new_name = mb_substr($name,0, 31-mb_strlen($postfix)) . $postfix;
}
$NEW_NAME = mb_strtoupper( $new_name );
if ( !isset( $names[ $NEW_NAME ]) ) {
$name = $new_name;
break;
}
}
}
$this->sheets[$this->curSheet] = ['name' => $name, 'hyperlinks' => [], 'mergecells' => []];
if ( isset( $rows[0] ) && is_array($rows[0]) ) {
$this->sheets[$this->curSheet]['rows'] = $rows;
} else {
$this->sheets[$this->curSheet]['rows'] = [];
}
return $this;
}
public function __toString() {
$fh = fopen( 'php://memory', 'wb' );
if ( ! $fh ) {
return '';
}
if ( ! $this->_write( $fh ) ) {
fclose( $fh );
return '';
}
$size = ftell( $fh );
fseek( $fh, 0);
return (string) fread( $fh, $size );
}
public function saveAs( $filename ) {
$fh = fopen( $filename, 'wb' );
if (!$fh) {
return false;
}
if ( !$this->_write($fh) ) {
fclose($fh);
return false;
}
fclose($fh);
return true;
}
public function download() {
return $this->downloadAs( gmdate('YmdHi') . '.xlsx' );
}
public function downloadAs( $filename ) {
$fh = fopen('php://memory','wb');
if (!$fh) {
return false;
}
if ( !$this->_write( $fh )) {
fclose( $fh );
return false;
}
$size = ftell($fh);
header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T' , time() ));
header('Content-Length: '.$size);
while( ob_get_level() ) {
ob_end_clean();
}
fseek($fh,0);
fpassthru( $fh );
fclose($fh);
return true;
}
protected function _write( $fh ) {
$dirSignatureE= "\x50\x4b\x05\x06"; // end of central dir signature
$zipComments = 'Generated by '.__CLASS__.' PHP class, thanks sergey.shuchkin@gmail.com';
if (!$fh) {
return false;
}
$cdrec = ''; // central directory content
$entries= 0; // number of zipped files
$cnt_sheets = count( $this->sheets );
foreach ($this->template as $cfilename => $template ) {
if ( $cfilename === 'xl/_rels/workbook.xml.rels' ) {
$s = '';
for ( $i = 0; $i < $cnt_sheets; $i++) {
$s .= '<Relationship Id="rId'.($i+2).'" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"'.
' Target="worksheets/sheet'.($i+1).".xml\"/>\n";
}
$s .= '<Relationship Id="rId'.($i+2).'" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/></Relationships>';
$template = str_replace('{SHEETS}', $s, $template);
$this->_writeEntry($fh, $cdrec, $cfilename, $template);
$entries++;
} elseif ( $cfilename === 'xl/workbook.xml' ) {
$s = '';
foreach ( $this->sheets as $k => $v ) {
$s .= '<sheet name="' . $this->esc( $v['name'] ) . '" sheetId="' . ( $k + 1) . '" state="visible" r:id="rId' . ( $k + 2) . '"/>';
}
$template = str_replace('{SHEETS}', $s, $template);
$this->_writeEntry($fh, $cdrec, $cfilename, $template);
$entries++;
}
elseif ( $cfilename === 'docProps/core.xml' ) {
$template = str_replace('{DATE}', gmdate('Y-m-d\TH:i:s\Z'), $template);
$this->_writeEntry($fh, $cdrec, $cfilename, $template);
$entries++;
} elseif ( $cfilename === 'xl/sharedStrings.xml' ) {
if (!count($this->SI)) {
$this->SI[] = 'No Data';
}
$si_cnt = count($this->SI);
$si = '<si><t>'.implode("</t></si>\r\n<si><t>", $this->SI).'</t></si>';
$template = str_replace(['{CNT}', '{STRINGS}'], [ $si_cnt, $si ], $template );
$this->_writeEntry($fh, $cdrec, $cfilename, $template);
$entries++;
} elseif ( $cfilename === 'xl/worksheets/sheet1.xml' ) {
foreach ( $this->sheets as $k => $v ) {
$filename = 'xl/worksheets/sheet'.($k+1).'.xml';
$xml = $this->_sheetToXML($k, $template);
$this->_writeEntry($fh, $cdrec, $filename, $xml );
$entries++;
}
$xml = null;
} elseif ( $cfilename === 'xl/worksheets/_rels/sheet1.xml.rels' ) {
foreach ( $this->sheets as $k => $v ) {
if ( count($v['hyperlinks'])) {
$RH = [];
$filename = 'xl/worksheets/_rels/sheet' . ( $k + 1 ) . '.xml.rels';
foreach ( $v['hyperlinks'] as $h ) {
$RH[] = '<Relationship Id="' . $h['ID'] . '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Target="' . $this->esc($h['H']) . '" TargetMode="External"/>';
}
$xml = str_replace( '{HYPERLINKS}', implode( "\r\n", $RH ), $template );
$this->_writeEntry( $fh, $cdrec, $filename, $xml );
$entries++;
}
}
$xml = null;
} elseif ( $cfilename === '[Content_Types].xml' ) {
$TYPES = ['<Override PartName="/_rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>'];
foreach ( $this->sheets as $k => $v) {
$TYPES[] = '<Override PartName="/xl/worksheets/sheet'.($k+1).
'.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>';
if (count( $v['hyperlinks'])) {
$TYPES[] = '<Override PartName="/xl/worksheets/_rels/sheet'.($k+1).'.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>';
}
}
$template = str_replace('{TYPES}', implode("\r\n", $TYPES), $template);
$this->_writeEntry($fh, $cdrec, $cfilename, $template);
$entries++;
} elseif ( $cfilename === 'xl/styles.xml' ) {
$XF = $FONTS = $F_KEYS = $FILLS = $FL_KEYS = [];
// print_r( $this->XF );
foreach( $this->XF as $xf ) {
// 0 - num fmt, 1 - align, 2 - font, 3 - fill, 4 - font color, 5 - bgcolor
// fonts
$F_KEY = $xf[2].'-'.$xf[4];
if ( isset($F_KEYS[ $F_KEY ]) ) {
$F_ID = $F_KEYS[ $F_KEY ];
} else {
$F_ID = $F_KEYS[ $F_KEY ] = count( $FONTS );
$FONTS[] = '<font><name val="'.$this->defaultFont.'"/><family val="2"/>'
. ( $this->defaultFontSize ? '<sz val="'.$this->defaultFontSize.'"/>' : '' )
.( $xf[2] & self::F_BOLD ? '<b/>' : '')
.( $xf[2] & self::F_ITALIC ? '<i/>' : '')
.( $xf[2] & self::F_UNDERLINE ? '<u/>' : '')
.( $xf[2] & self::F_STRIKE ? '<strike/>' : '')
.( $xf[2] & self::F_HYPERLINK ? '<u/>' : '')
.( $xf[2] & self::F_COLOR ? '<color rgb="'.$xf[4].'"/>' : '')
.'</font>';
}
// fills
$FL_KEY = $xf[3].'-'.$xf[5];
if (isset($FL_KEYS[$FL_KEY])) {
$FL_ID = $FL_KEYS[ $FL_KEY ];
} else {
$FL_ID = $FL_KEYS[ $FL_KEY ] = count($FILLS);
$FILLS[] = '<fill><patternFill patternType="'
.( $xf[3] === 0 ? 'none' : '')
.( $xf[3] & self::FL_SOLID ? 'solid' : '')
.( $xf[3] & self::FL_MEDIUM_GRAY ? 'mediumGray' : '')
.( $xf[3] & self::FL_DARK_GRAY ? 'darkGray' : '')
.( $xf[3] & self::FL_LIGHT_GRAY ? 'lightGray' : '')
.( $xf[3] & self::FL_GRAY_125 ? 'gray125' : '')
.'"'
.( $xf[3] & self::FL_COLOR ? '><fgColor rgb="'.$xf[5].'"/><bgColor indexed="64"/></patternFill>' : ' />')
.'</fill>';
}
$align = ($xf[1] & self::A_LEFT ? ' horizontal="left"' : '')
.($xf[1] & self::A_RIGHT ? ' horizontal="right"' : '')
.($xf[1] & self::A_CENTER ? ' horizontal="center"' : '')
.($xf[1] & self::A_TOP ? ' vertical="top"' : '')
.($xf[1] & self::A_MIDDLE ? ' vertical="center"' : '')
.($xf[1] & self::A_BOTTOM ? ' vertical="bottom"' : '');
$XF[] = '<xf numFmtId="'.$xf[0].'" fontId="'.$F_ID.'" fillId="'.$FL_ID.'" borderId="0" xfId="0"'
.($xf[0] > 0 ? ' applyNumberFormat="1"' : '')
.($F_ID > 0 ? ' applyFont="1"' : '')
.($FL_ID > 0 ? ' applyFill="1"' : '')
.($align ? ' applyAlignment="1"><alignment'.$align . '/></xf>' : '/>');
}
// wrap collections
array_unshift( $XF, '<cellXfs count="'.count($XF).'">');
$XF[] = '</cellXfs>';
array_unshift($FONTS, '<fonts count="'.count($FONTS).'">');
$FONTS[] = '</fonts>';
array_unshift($FILLS, '<fills count="'.count($FILLS).'">');
$FILLS[] = '</fills>';
$template = str_replace(['{FONTS}','{XF}','{FILLS}'], [implode("\r\n", $FONTS), implode("\r\n", $XF), implode("\r\n", $FILLS)], $template);
$this->_writeEntry($fh, $cdrec, $cfilename, $template);
$entries++;
} else {
$this->_writeEntry($fh, $cdrec, $cfilename, $template);
$entries++;
}
}
$before_cd = ftell($fh);
fwrite($fh, $cdrec);
// end of central dir
fwrite($fh, $dirSignatureE);
fwrite($fh, pack('v', 0)); // number of this disk
fwrite($fh, pack('v', 0)); // number of the disk with the start of the central directory
fwrite($fh, pack('v', $entries)); // total # of entries "on this disk"
fwrite($fh, pack('v', $entries)); // total # of entries overall
fwrite($fh, pack('V', mb_strlen($cdrec,'8bit'))); // size of central dir
fwrite($fh, pack('V', $before_cd)); // offset to start of central dir
fwrite($fh, pack('v', mb_strlen($zipComments,'8bit'))); // .zip file comment length
fwrite($fh, $zipComments);
return true;
}
protected function _writeEntry($fh, &$cdrec, $cfilename, $data) {
$zipSignature = "\x50\x4b\x03\x04"; // local file header signature
$dirSignature = "\x50\x4b\x01\x02"; // central dir header signature
$e = [];
$e['uncsize'] = mb_strlen($data, '8bit');
// if data to compress is too small, just store it
if($e['uncsize'] < 256){
$e['comsize'] = $e['uncsize'];
$e['vneeded'] = 10;
$e['cmethod'] = 0;
$zdata = $data;
} else{ // otherwise, compress it
$zdata = gzcompress($data);
$zdata = substr(substr($zdata, 0, - 4 ), 2); // fix crc bug (thanks to Eric Mueller)
$e['comsize'] = mb_strlen($zdata, '8bit');
$e['vneeded'] = 10;
$e['cmethod'] = 8;
}
$e['bitflag'] = 0;
$e['crc_32'] = crc32($data);
// Convert date and time to DOS Format, and set then
$lastmod_timeS = str_pad(decbin(date('s')>=32?date('s')-32:date('s')), 5, '0', STR_PAD_LEFT);
$lastmod_timeM = str_pad(decbin(date('i')), 6, '0', STR_PAD_LEFT);
$lastmod_timeH = str_pad(decbin(date('H')), 5, '0', STR_PAD_LEFT);
$lastmod_dateD = str_pad(decbin(date('d')), 5, '0', STR_PAD_LEFT);
$lastmod_dateM = str_pad(decbin(date('m')), 4, '0', STR_PAD_LEFT);
$lastmod_dateY = str_pad(decbin(date('Y')-1980), 7, '0', STR_PAD_LEFT);
# echo "ModTime: $lastmod_timeS-$lastmod_timeM-$lastmod_timeH (".date("s H H").")\n";
# echo "ModDate: $lastmod_dateD-$lastmod_dateM-$lastmod_dateY (".date("d m Y").")\n";
$e['modtime'] = bindec("$lastmod_timeH$lastmod_timeM$lastmod_timeS");
$e['moddate'] = bindec("$lastmod_dateY$lastmod_dateM$lastmod_dateD");
$e['offset'] = ftell($fh);
fwrite($fh, $zipSignature);
fwrite($fh, pack('s', $e['vneeded'])); // version_needed
fwrite($fh, pack('s', $e['bitflag'])); // general_bit_flag
fwrite($fh, pack('s', $e['cmethod'])); // compression_method
fwrite($fh, pack('s', $e['modtime'])); // lastmod_time
fwrite($fh, pack('s', $e['moddate'])); // lastmod_date
fwrite($fh, pack('V', $e['crc_32'])); // crc-32
fwrite($fh, pack('I', $e['comsize'])); // compressed_size
fwrite($fh, pack('I', $e['uncsize'])); // uncompressed_size
fwrite($fh, pack('s', mb_strlen($cfilename, '8bit'))); // file_name_length
fwrite($fh, pack('s', 0)); // extra_field_length
fwrite($fh, $cfilename); // file_name
// ignoring extra_field
fwrite($fh, $zdata);
// Append it to central dir
$e['external_attributes'] = (substr($cfilename, -1) === '/'&&!$zdata)?16:32; // Directory or file name
$e['comments'] = '';
$cdrec .= $dirSignature;
$cdrec .= "\x0\x0"; // version made by
$cdrec .= pack('v', $e['vneeded']); // version needed to extract
$cdrec .= "\x0\x0"; // general bit flag
$cdrec .= pack('v', $e['cmethod']); // compression method
$cdrec .= pack('v', $e['modtime']); // lastmod time
$cdrec .= pack('v', $e['moddate']); // lastmod date
$cdrec .= pack('V', $e['crc_32']); // crc32
$cdrec .= pack('V', $e['comsize']); // compressed filesize
$cdrec .= pack('V', $e['uncsize']); // uncompressed filesize
$cdrec .= pack('v', mb_strlen($cfilename,'8bit')); // file name length
$cdrec .= pack('v', 0); // extra field length
$cdrec .= pack('v', mb_strlen($e['comments'],'8bit')); // file comment length
$cdrec .= pack('v', 0); // disk number start
$cdrec .= pack('v', 0); // internal file attributes
$cdrec .= pack('V', $e['external_attributes']); // internal file attributes
$cdrec .= pack('V', $e['offset']); // relative offset of local header
$cdrec .= $cfilename;
$cdrec .= $e['comments'];
}
protected function _sheetToXML($idx, $template) {
// locale floats fr_FR 1.234,56 -> 1234.56
$_loc = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC,'C');
$COLS = [];
$ROWS = [];
if ( count($this->sheets[$idx]['rows']) ) {
$COLS[] = '<cols>';
$CUR_ROW = 0;
$COL = [];
foreach( $this->sheets[$idx]['rows'] as $r ) {
$CUR_ROW++;
$row = '';
$CUR_COL = 0;
$RH = 0; // row height
foreach( $r as $v ) {
$CUR_COL++;
if ( !isset($COL[ $CUR_COL ])) {
$COL[ $CUR_COL ] = 0;
}
$cname = $this->num2name($CUR_COL) . $CUR_ROW;
if ( $v === null || $v === '' ) {
$row .= '<c r="'.$cname.'"/>';
continue;
}
$ct = $cv = null;
$N = $A = $F = $FL = $C = $B = 0;
if ( is_string($v) ) {
if ( $v[0] === "\0" ) { // RAW value as string
$v = substr($v,1);
$vl = mb_strlen( $v );
} else {
if ( strpos( $v, '<' ) !== false ) { // tags?
if ( strpos( $v, '<b>' ) !== false ) {
$F += self::F_BOLD;
}
if ( strpos( $v, '<i>' ) !== false ) {
$F += self::F_ITALIC;
}
if ( strpos( $v, '<u>' ) !== false ) {
$F += self::F_UNDERLINE;
}
if ( strpos( $v, '<s>' ) !== false ) {
$F += self::F_STRIKE;
}
if ( preg_match('/<style([^>]+)>/', $v, $m ) ) {
if ( preg_match('/ color="([^"]+)"/', $m[1], $m2) ) {
$F += self::F_COLOR;
$C = strlen($m2[1]) === 8 ? $m2[1] : ('FF' . ltrim($m2[1],'#'));
}
if ( preg_match('/ bgcolor="([^"]+)"/', $m[1], $m2) ) {
$FL += self::FL_COLOR;
$B = strlen($m2[1]) === 8 ? $m2[1] : ('FF' . ltrim($m2[1],'#'));
}
if ( preg_match('/ height="([^"]+)"/', $m[1], $m2) ) {
$RH = $m2[1];
}
}
if ( strpos( $v, '<left>' ) !== false ) {
$A += self::A_LEFT;
}
if ( strpos( $v, '<center>' ) !== false ) {
$A += self::A_CENTER;
}
if ( strpos( $v, '<right>' ) !== false ) {
$A += self::A_RIGHT;
}
if ( strpos( $v, '<top>' ) !== false ) {
$A += self::A_TOP;
}
if ( strpos( $v, '<middle>' ) !== false ) {
$A += self::A_MIDDLE;
}
if ( strpos( $v, '<bottom>' ) !== false ) {
$A += self::A_BOTTOM;
}
if ( preg_match( '/<a href="(https?:\/\/[^"]+)">(.*?)<\/a>/i', $v, $m ) ) {
$h = explode( '#', $m[1] );
$this->sheets[ $idx ]['hyperlinks'][] = ['ID' => 'rId' . ( count( $this->sheets[ $idx ]['hyperlinks'] ) + 1 ), 'R' => $cname, 'H' => $h[0], 'L' => isset( $h[1] ) ? $h[1] : ''];
$F += self::F_HYPERLINK; // Hyperlink
}
if ( preg_match( '/<a href="(mailto?:[^"]+)">(.*?)<\/a>/i', $v, $m ) ) {
$this->sheets[ $idx ]['hyperlinks'][] = ['ID' => 'rId' . ( count( $this->sheets[ $idx ]['hyperlinks'] ) + 1 ), 'R' => $cname, 'H' => $m[1], 'L' => ''];
$F += self::F_HYPERLINK; // mailto hyperlink
}
$v = strip_tags( $v );
} // tags
$vl = mb_strlen( $v );
if ( $v === '0' || preg_match( '/^[-+]?[1-9]\d{0,14}$/', $v ) ) { // Integer as General
$cv = ltrim( $v, '+' );
if ( $vl > 10 ) {
$N = self::N_INT; // [1] 0
}
} elseif ( preg_match( '/^[-+]?(0|[1-9]\d*)\.(\d+)$/', $v, $m ) ) {
$cv = ltrim( $v, '+' );
if ( strlen( $m[2] ) < 3 ) {
$N = self::N_DEC;
}
} elseif ( preg_match( '/^([-+]?\d+)%$/', $v, $m ) ) {
$cv = round( $m[1] / 100, 2 );
$N = self::N_PERCENT_INT; // [9] 0%
} elseif ( preg_match( '/^([-+]?\d+\.\d+)%$/', $v, $m ) ) {
$cv = round( $m[1] / 100, 4 );
$N = self::N_PRECENT_DEC; // [10] 0.00%
} elseif ( preg_match( '/^(\d\d\d\d)-(\d\d)-(\d\d)$/', $v, $m ) ) {
$cv = $this->date2excel( $m[1], $m[2], $m[3] );
$N = self::N_DATE; // [14] mm-dd-yy
} elseif ( preg_match( '/^(\d\d)\/(\d\d)\/(\d\d\d\d)$/', $v, $m ) ) {
$cv = $this->date2excel( $m[3], $m[2], $m[1] );
$N = self::N_DATE; // [14] mm-dd-yy
} elseif ( preg_match( '/^(\d\d):(\d\d):(\d\d)$/', $v, $m ) ) {
$cv = $this->date2excel( 0, 0, 0, $m[1], $m[2], $m[3] );
$N = self::N_TIME; // time
} elseif ( preg_match( '/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/', $v, $m ) ) {
$cv = $this->date2excel( $m[1], $m[2], $m[3], $m[4], $m[5], $m[6] );
$N = ((int) $m[1] === 0) ? self::N_TIME : self::N_DATETIME; // [22] m/d/yy h:mm
} elseif ( preg_match( '/^(\d\d)\/(\d\d)\/(\d\d\d\d) (\d\d):(\d\d):(\d\d)$/', $v, $m ) ) {
$cv = $this->date2excel( $m[3], $m[2], $m[1], $m[4], $m[5], $m[6] );
$N = self::N_DATETIME; // [22] m/d/yy h:mm
} elseif ( preg_match( '/^[0-9+-.]+$/', $v ) ) { // Long ?
$A += self::A_RIGHT;
} elseif ( preg_match( '/^https?:\/\/\S+$/i', $v ) ) {
$h = explode( '#', $v );
$this->sheets[ $idx ]['hyperlinks'][] = ['ID' => 'rId' . ( count( $this->sheets[ $idx ]['hyperlinks'] ) + 1 ), 'R' => $cname, 'H' => $h[0], 'L' => isset( $h[1] ) ? $h[1] : ''];
$F += self::F_HYPERLINK; // Hyperlink
} elseif ( preg_match( "/^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/", $v ) ) {
$this->sheets[ $idx ]['hyperlinks'][] = ['ID' => 'rId' . ( count( $this->sheets[ $idx ]['hyperlinks'] ) + 1 ), 'R' => $cname, 'H' => 'mailto:' . $v, 'L' => ''];
$F += self::F_HYPERLINK; // Hyperlink
}
if ( ($N === self::N_DATE || $N === self::N_DATETIME) && $cv < 0 ) {
$cv = null;
$N = 0;
}
}
if ( !$cv) {
$v = $this->esc( $v );
if ( mb_strlen( $v ) > 160 ) {
$ct = 'inlineStr';
$cv = $v;
} else {
$ct = 's'; // shared string
$cv = false;
$skey = '~' . $v;
if ( isset( $this->SI_KEYS[ $skey ] ) ) {
$cv = $this->SI_KEYS[ $skey ];
}
if ( $cv === false ) {
$this->SI[] = $v;
$cv = count( $this->SI ) - 1;
$this->SI_KEYS[ $skey ] = $cv;
}
}
}
} elseif ( is_int( $v ) ) {
$vl = mb_strlen( (string) $v );
$cv = $v;
} elseif ( is_float( $v ) ) {
$vl = mb_strlen( (string) $v );
$cv = $v;
} elseif ( $v instanceof \DateTime ) {
$vl = 16;
$cv = $this->date2excel($v->format('Y'), $v->format('m'), $v->format('d'), $v->format('H'), $v->format('i'), $v->format('s'));
$N = self::N_DATETIME; // [22] m/d/yy h:mm
} else {
continue;
}
$COL[ $CUR_COL ] = max( $vl, $COL[ $CUR_COL ] );
$cs = 0;
if ( $N + $A + $F + $FL > 0 ) {
if ( $FL === self::FL_COLOR ) {
$FL += self::FL_SOLID;
}
if ( ($F & self::F_HYPERLINK) && !($F & self::F_COLOR)) {
$F += self::F_COLOR;
$C = 'FF0563C1';
}
$XF_KEY = $N . '-' . $A . '-' . $F. '-'. $FL . '-' . $C . '-' . $B;
// echo $cname .'='.$XF_KEY.PHP_EOL;
if ( isset( $this->XF_KEYS[ $XF_KEY ] ) ) {
$cs = $this->XF_KEYS[ $XF_KEY ];
}
if ( $cs === 0 ) {
$cs = count( $this->XF );
$this->XF_KEYS[ $XF_KEY ] = $cs;
$this->XF[] = [$N, $A, $F, $FL, $C, $B];
}
}
$row .= '<c r="' . $cname . '"' . ($ct ? ' t="' . $ct . '"' : '') . ($cs ? ' s="' . $cs . '"' : '') . '>'
. ($ct === 'inlineStr' ? '<is><t>' . $cv . '</t></is>' : '<v>' . $cv . '</v>') . "</c>\r\n";
}
$ROWS[] = '<row r="'.$CUR_ROW.'"'.($RH ? ' customHeight="1" ht="'.$RH.'"' : '').'>'.$row . "</row>";
}
foreach ( $COL as $k => $max ) {
$COLS[] = '<col min="'.$k.'" max="'.$k.'" width="'.min( $max+1, 60).'" />';
}
$COLS[] = '</cols>';
$REF = 'A1:'.$this->num2name(count($COL)) . $CUR_ROW;
} else {
$ROWS[] = '<row r="1"><c r="A1" t="s"><v>0</v></c></row>';
$REF = 'A1:A1';
}
$MERGECELLS = [];
if ( count($this->sheets[$idx]['mergecells']) ) {
$MERGECELLS[] = '';
$MERGECELLS[] = '<mergeCells count="'.count($this->sheets[$idx]['mergecells']).'">';
foreach( $this->sheets[$idx]['mergecells'] as $m ) {
$MERGECELLS[] = '<mergeCell ref="'.$m.'"/>';
}
$MERGECELLS[] = '</mergeCells>';
}
$HYPERLINKS = [];
if ( count( $this->sheets[$idx]['hyperlinks']) ) {
$HYPERLINKS[] = '<hyperlinks>';
foreach ( $this->sheets[$idx]['hyperlinks'] as $h ) {
$HYPERLINKS[] = '<hyperlink ref="' . $h['R'] . '" r:id="' . $h['ID'] . '" location="' . $this->esc( $h['L'] ) . '" display="' . $this->esc( $h['H'] . ( $h['L'] ? ' - ' . $h['L'] : '' ) ) . '" />';
}
$HYPERLINKS[] = '</hyperlinks>';
}
//restore locale
setlocale(LC_NUMERIC, $_loc);
return str_replace(['{REF}','{COLS}','{ROWS}','{MERGECELLS}','{HYPERLINKS}'],
[ $REF, implode("\r\n", $COLS), implode("\r\n",$ROWS), implode("\r\n", $MERGECELLS), implode("\r\n", $HYPERLINKS) ],
$template );
}
public function num2name($num) {
$numeric = ($num - 1) % 26;
$letter = chr( 65 + $numeric );
$num2 = (int) ( ($num-1) / 26 );
if ( $num2 > 0 ) {
return $this->num2name( $num2 ) . $letter;
}
return $letter;
}
public function date2excel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) {
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
if ( (int) $year === 0 ) {
return $excelTime;
}
// self::CALENDAR_WINDOWS_1900
$excel1900isLeapYear = True;
if (($year === 1900) && ($month <= 2)) { $excel1900isLeapYear = False; }
$myExcelBaseDate = 2415020;
// Julian base date Adjustment
if ($month > 2) {
$month -= 3;
} else {
$month += 9;
--$year;
}
$century = substr($year,0,2);
$decade = substr($year,2,2);
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myExcelBaseDate + $excel1900isLeapYear;
return (float) $excelDate + $excelTime;
}
public function setDefaultFont( $name ) {
$this->defaultFont = $name;
return $this;
}
public function setDefaultFontSize( $size ) {
$this->defaultFontSize = $size;
return $this;
}
public function mergeCells( $range ) {
$this->sheets[$this->curSheet]['mergecells'][] = $range;
return $this;
}
public function esc( $str ) {
// XML UTF-8: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
// but we use fast version
return str_replace( ['&', '<', '>', "\x00","\x03","\x0B"], ['&amp;', '&lt;', '&gt;', '', '', ''], $str );
}
}

View File

@ -0,0 +1,93 @@
<?php
if ($_SERVER['HTTP_HOST'] == 'www.archline.hu')
require_once('language/hu-HU.lang.php');
else
require_once('language/en-GB.lang.php');
error_reporting(E_ERROR | E_PARSE);
session_start();
if (isset($_SESSION['username'])) header("location: index");
$error = '';
if (isset($_POST['submit'])) {
if (!class_exists('Login'))
require_once("../common_cadline_libraries/crm_users.class.php");
$login = new Login($_POST["username"], $_POST["password"]);
if ($login->verifyPassword()) {
$_SESSION['username'] = $login->getUsername();
if ($_SERVER['HTTP_HOST'] == 'www.archline.hu')
header("location: https://" . $_SERVER['HTTP_HOST'] . "/iskolak/");
else
header("location: https://" . $_SERVER['HTTP_HOST'] . "/school/");
} else {
$error = $loginPage['login_error'];
}
}
?>
<html>
<head>
<style media="screen">
.col-centered {
float: none;
margin: 0 auto;
}
.alert {
margin-left: 3% !important;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="<?= $home['favicon'] ?>" type="image/vnd.microsoft.icon" />
<link rel="stylesheet" href="public/css/bootstrap.min.css?<?= time() ?>" type="text/css" />
<link rel="stylesheet" href="public/css/main.css" type="text/css" />
<title><?= $loginPage['login'] ?></title>
</head>
<body>
<form action="" method="POST" id="login-form">
<div class="container">
<div class="col-md-6 col-centered">
<?php if ($error != "") : ?>
<div class="alert alert-danger col-md-8" role="alert">
<?= $error ?>
</div>
<?php endif; ?>
<div class="row">
<div id="form-login-username" class="form-group col-md-9">
<input id="modlgn-username" type="text" name="username" class="form-control" tabindex="0" size="18" placeholder="<?= $loginPage['username'] ?>" required />
</div>
</div>
<div class="row">
<div id="form-login-password" class="form-group col-md-9">
<div class="controls">
<input id="modlgn-passwd" type="password" name="password" class="form-control" tabindex="0" size="18" placeholder="<?= $loginPage['password'] ?>" required />
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<input type="submit" value="<?= $loginPage['login'] ?>" class="btn btn-primary" id="loginbtn" name="submit" />
</div>
</div>
</div>
</div>
</form>
<script>
document.getElementById("modlgn-username").focus();
</script>
</body>
</html>

View File

@ -0,0 +1,8 @@
<?php
session_start();
session_unset();
session_destroy();
header("location:login");
exit();
?>

View File

@ -0,0 +1,335 @@
<?php
if (!class_exists('Student')) require_once("../common_cadline_libraries/crm_hardlock.class.php");
if ($_SERVER['HTTP_HOST'] == 'www.archline.hu')
require_once('language/hu-HU.lang.php');
else
require_once('language/en-GB.lang.php');
$action = isset($_POST['action']) ? $_POST['action'] : '';
if (isset($action) && $action != '') {
$student = new Student();
switch ($action) {
case 'readrecord': { // Get the students
$course_id = isset($_POST['course_id']) ? $_POST['course_id'] : '';
if (!isset($course_id) || $course_id == '') {
echo json_encode($process['wrong_course']);
die();
}
$courses = json_decode($_POST['courseArray']);
$search = isset($_POST['search_name']) ? $_POST['search_name'] : '';
$student->setCourseID($course_id);
$studentsArray = $student->getAllStudents($search, $courses);
echo json_encode($studentsArray);
break;
}
case 'readEmailRecord': {
$course_id = isset($_POST['course_id']) ? $_POST['course_id'] : '';
if (!isset($course_id) || $course_id == '') {
echo json_encode($process['wrong_course']);
die();
}
$student->setCourseID($course_id);
$studentsArray = $student->getAllStudents($search, []);
echo json_encode($studentsArray);
break;
}
case 'create': { // Insert a new student
$course_id = isset($_POST['course_id']) ? $_POST['course_id'] : '';
if (!isset($course_id) || $course_id == '') {
echo json_encode($process['wrong_course']);
die();
}
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$school_id = $_POST["schoolid"];
$student->setCourseID($course_id);
$course = $student->getCourseByID();
$sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`students` WHERE email = ?";
$student->query($sql, array('s', $email));
$students = $student->fetchNext();
if (!empty($students)) {
if ($student->studentInOtherSchool($school_id, $students['school_id']))
echo json_encode($process['other_school']);
else
echo json_encode($process['user_already']);
die();
}
$student->setName($name);
$student->setEmail($email);
$student->setPhone($phone);
$student->setSchoolID($school_id);
$student->setCourseID($course_id);
$student->setEndDate($course["vegzes_ideje"]);
$student->setSchool();
$student->setCourse();
$student->addStudent();
if ($student->getnUserID() == null) {
echo json_encode($process['user_failed']);
die();
}
$student->generateStudentPassword();
break;
}
case 'delete': { // Delete the selected student
if (isset($_POST['deletedid'])) $student->deleteStudent($_POST['deletedid']);
break;
}
case 'details': { // Get the selected student's details
if (isset($_POST["editid"])) {
$userid = $_POST["editid"];
$response = array();
$student->getStudent($_POST["editid"], $response);
echo json_encode($response);
} else {
$response["status"] = 200;
$response["message"] = "Invalid Request!";
}
break;
}
case 'update': { // Edit the selected student
if (isset($_POST["hidden_user_id"])) {
$userid = $_POST["hidden_user_id"];
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$course_id = $_POST["course_id"];
$status = $_POST["status"];
$isDelete = $_POST["isDelete"] == "Y";
$student->setCourseID($course_id);
$course = $student->getCourseByID();
$student->setSchoolID($course['school_id']);
$school = $student->getSchoolByID();
$begin = str_replace('-', '.', $course["begin"]);
$end = str_replace('-', '.', $course["vegzes_ideje"]);
$strEducation = $school['username'] . " " . $course['course_code'] . " " . $begin . " - " . $end;
$student->setName($name);
$student->setEmail($email);
$student->setPhone($phone);
$student->setSchoolID($course['school_id']);
$student->setnSchoolID($school['nSchoolID']);
$student->setCourseID($course_id);
$student->setEndDate($course["vegzes_ideje"]);
$student->setEducation($strEducation);
$student->setSchool();
$student->setCourse();
$student->setStatus($status);
$student->updateStudent($userid, $isDelete);
}
break;
}
case 'sendEmail': { // Send email to the selected students
if (isset($_POST['selected'])) {
$selected = json_decode(stripslashes($_POST['selected']));
$school_id = $_POST['school_id'];
$course_id = $_POST['course_id'];
$isSend = array();
$error = false;
$student->setSchoolID($school_id);
$student->setCourseID($course_id);
$student->setSchool();
$student->setCourse();
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php');
$mail = new PHPMailer();
$mail->isSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = $mailconfig['Host'];
$mail->Port = $mailconfig['Port'];
$mail->SMTPAuth = true;
$mail->SMTPKeepAlive = true;
$mail->Username = $mailconfig['Username'];
$mail->Password = $mailconfig['Password'];
if ($student->schoolEmail != '') {
foreach ($selected as $student_id) {
$student->sendDistributorEmail($student_id, $error, $isSend, $student->schoolEmail, $mail);
}
echo json_encode($isSend);
die();
}
foreach ($selected as $student_id) {
if ($_SERVER['HTTP_HOST'] == 'www.archline.hu')
$student->sendEmail($student_id, $error, $isSend, $mail);
else
$student->sendEngEmail($student_id, $error, $isSend, $mail);
}
$msg = "";
if ($error) {
$to = "marketing@cadline.hu";
$subject = 'Email küldés hiba';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "From: mate.nagy@cadline.hu" . "\r\n";
$counter = 0;
$msg .= "A következő email címekre nem ment ki a levél: ";
foreach ($isSend as $email) {
if ($counter == 0)
$msg .= $email;
else
$msg .= ', ' . $email;
$counter++;
}
mail($to, $subject, $msg, $headers);
}
echo json_encode($isSend);
} else {
echo json_encode($process['email_failed']);
}
break;
}
case 'excel_export': {
require_once 'library/SimpleXLSXGen.php';
$courses = array();
$course_id = $_POST['excel_c_id'];
$search = '';
$student->setCourseID($course_id);
$studentsArray = $student->getAllStudents($search, $courses);
$school = $student->getSchoolByCourse();
$header = array();
if ($_SERVER['HTTP_HOST'] == 'www.archline.hu')
$header = array('<b>Név</b>', '<b>Email</b>', '<b>Telefonszám</b>', '<b>Státusz</b>', '<b>ARCHLine.XP Sorozatszám</b>', '<b>Program indítások</b>');
else
$header = array('<b>Name</b>', '<b>Email</b>', '<b>Telephone Number</b>', '<b>Status</b>', '<b>ARCHLine.XP Serial Number</b>', '<b>Program Starts</b>');
$students = array($header);
$pwd = '';
foreach ($studentsArray as $stud) {
if (preg_match('/>(.*?)</', $stud['prPass'], $pwd) == 1)
$pwd = $pwd[1];
$starts = $student->getProgramStarts($pwd);
$status = $student->getStudentStatus($stud['status']);
$studentDatas = array($stud['name'], $stud['email'], $stud['phone'], $status, $pwd, $starts);
array_push($students, $studentDatas);
}
$xlsx = Shuchkin\SimpleXLSXGen::fromArray($students);
$xlsx->setDefaultFontSize(14);
$xlsx->downloadAs($school['school_name'] . '_' . $school['course_name'] . '.xlsx');
break;
}
case 'excel_import': { // Import students from XLSX file
if (isset($_POST['schoolid'])) {
require_once 'library/SimpleXLSX.php';
$school_id = $_POST["schoolid"];
$course_id = $_POST["course_id"];
$values = array();
$error = array();
$xlsx = SimpleXLSX::parse($_FILES['file']['tmp_name']);
foreach ($xlsx->rows() as $k => $v) {
if ($k == 0) continue;
$values[] = array(
'name' => $v[0],
'email' => $v[1],
'phone' => $v[2]
);
}
$student->setSchoolID($school_id);
$student->setCourseID($course_id);
$student->setSchool();
$student->setCourse();
$course = $student->getCourseByID();
foreach ($values as $stud) {
$name = $stud['name'];
$email = str_replace(' ', '', $stud["email"]);
$phone = $stud["phone"];
if ($name == '') continue;
if (is_numeric($name)) {
array_push($error, $process['number_name'] . ": " . $name);
continue;
}
if ($email == '') {
array_push($error, $process['missing_email'] . ": " . $name);
continue;
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
array_push($error, $process['invalid_email'] . ": " . $email);
continue;
}
$sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`students` WHERE email = ?";
$student->query($sql, array('s', $email));
$students = $student->fetchNext();
if (!empty($students)) {
if ($student->studentInOtherSchool($school_id, $students['school_id']))
array_push($error, $process['other_school'] . ": " . $email);
else
array_push($error, $process['email_already'] . ": " . $email);
continue;
}
$student->setName($name);
$student->setEmail($email);
$student->setPhone($phone);
$student->setEndDate($course["vegzes_ideje"]);
$student->addStudent();
if ($student->getnUserID() == null) {
array_push($error, $process['user_failed'] . ": " . $email);
continue;
}
$student->generateStudentPassword();
}
echo json_encode($error);
}
break;
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,58 @@
#login-form { margin-top: 15%; }
#error_div, #error_div2 { display: none; }
#pelda_excel { margin-left: -46%; }
#excl_btn { margin-left: 73.5%; }
#file_input { margin-left: 73.5%; }
#h_div { margin-left: -2%; }
#loginbtn, .alert { margin-left: 1.3%; }
.disabled, .inactive { cursor: not-allowed !important; }
.modal-header { cursor: move; }
#div_pagination {
width:100%;
margin-top:5px;
text-align:center;
}
.button1 {
border-radius:3px;
border:0px;
background-color:mediumpurple;
color:white;
padding:10px 20px;
letter-spacing: 1px;
}
#loading_gif {
position: absolute;
margin-left: 20%;
}
#search_all {
width: 20px;
height: 20px;
margin-left: 20px;
margin-top: 10px;
}
#search-txt {
margin-left: 5px;
margin-top: 8px;
}
#archiv_text {
display: none;
}
@media only screen and (max-width: 600px) {
#pelda_excel { margin-left: -85% !important; }
#excl_btn { margin-left: 0% !important; }
#email_btn { margin-top: 5% !important; }
#h_div { margin-top: 5% !important; }
#file_input { margin-left: 0% !important; }
#h_div { margin-left: 0% !important; }
}
@media only screen and (min-width: 600px) {
#export-form { position: absolute; }
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,638 @@
var courseArray = [];
$(document).ready(function () {
readRecords();
$('#send_email_btn').attr("disabled", true);
$('#send_email_btn').addClass('inactive');
$('#excl_btn').attr("disabled", true);
$('#excl_btn').addClass('inactive');
(function ($) {
$.fn.inputFilter = function (callback, errMsg) {
return this.on("input keydown keyup mousedown mouseup select contextmenu drop focusout", function (e) {
if (callback(this.value)) {
if (["keydown", "mousedown", "focusout"].indexOf(e.type) >= 0) {
$(this).removeClass("input-error");
this.setCustomValidity("");
}
this.oldValue = this.value;
this.oldSelectionStart = this.selectionStart;
this.oldSelectionEnd = this.selectionEnd;
} else if (this.hasOwnProperty("oldValue")) {
$(this).addClass("input-error");
this.setCustomValidity(errMsg);
this.reportValidity();
this.value = this.oldValue;
this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
} else {
this.value = "";
}
});
};
}(jQuery));
$("#phone").inputFilter(function (value) {
return /^-?\d*$/.test(value);
}, "A megadott érték nem szám");
$('select').on('change', function () {
readRecords();
$('#excel_c_id').val($('#course').val());
let archive = $('option:selected', this).attr('data-archive');
if (archive == 1 && $(this).attr('id') == 'course') {
$('#file_input').hide();
$('#pelda_excel').parent().hide();
$('#h_div').hide();
$('#excl_btn').hide();
$('#modal-div').hide();
$('#email_btn').hide();
$('#archiv_text').show();
} else if (archive != 1 && $(this).attr('id') == 'course') {
$('#file_input').show();
$('#pelda_excel').parent().show();
$('#h_div').show();
$('#excl_btn').show();
$('#modal-div').show();
$('#email_btn').show();
$('#archiv_text').hide();
}
});
$('#search_all').change(function () {
readRecords();
});
$("#course option").each(function () {
courseArray.push($(this).val());
});
// Check all checkboxes
$("#checkAll").click(function () {
let selected = [];
$('input:checkbox').not(this).prop('checked', this.checked);
$.each($("input[name='isEmailSend']:checked"), function () {
selected.push($(this).val());
});
checkEmailCheckboxes();
});
$('#excl_file').on('change', function () {
if ($('#excl_file')[0].files.length === 0) {
$('#excl_btn').attr("disabled", true);
$('#excl_btn').addClass('inactive');
} else {
$('#excl_btn').attr("disabled", false);
$('#excl_btn').removeClass('inactive');
}
});
});
var isHun = isDomainHun();
function showAddModal() {
$('#addModal').modal("show");
}
function emailModal() {
readEmailRecords();
}
function isDomainHun() {
return window.location.hostname == 'www.archline.hu';
}
function checkCheckboxes() {
let selected = [];
let allcheckbox = [];
$.each($("input[name='isEmailSend']:checked"), function () {
selected.push($(this).val());
});
$.each($("input[name='isEmailSend']"), function () {
allcheckbox.push($(this).val());
});
if ($("#checkAll").is(':checked') && selected.length !== allcheckbox.length)
$("#checkAll").prop("checked", false);
else if (!$("#checkAll").is(':checked') && selected.length === allcheckbox.length)
$("#checkAll").prop("checked", true);
checkEmailCheckboxes();
}
function checkEmailCheckboxes() {
let selected = [];
$.each($("input[name='isEmailSend']:checked"), function () {
selected.push($(this).val());
});
if (selected.length > 0) {
$('#send_email_btn').attr("disabled", false);
$('#send_email_btn').removeClass('inactive');
} else {
$('#send_email_btn').attr("disabled", true);
$('#send_email_btn').addClass('inactive');
}
}
// Get users
function readRecords() {
let action = "readrecord";
let search_name = $('#search_name').val();
let course_id = $("#course").val();
let coursesData = $('#search_all').is(':checked') ? courseArray : [];
let json = JSON.stringify(coursesData);
$.ajax({
url: "process.php",
type: "post",
data: {
action: action,
course_id: course_id,
search_name: search_name,
courseArray: json
},
dataType: 'json',
success: function (data) {
createTablerow(data);
},
error: function () {
$('#loading_gif').hide();
}
});
}
function readEmailRecords() {
let action = "readEmailRecord";
let course_id = $("#course").val();
$.ajax({
url: "process.php",
type: "post",
data: {
action: action,
course_id: course_id
},
dataType: 'json',
success: function (data) {
createEmailrow(data);
},
error: function () {
$('#loading_gif').hide();
}
});
}
function sendEmail() {
let lengthError, emailError, emailSuccess;
let action = "sendEmail";
let selected = [];
let course_id = $("#course").val();
let school_id = $('#school_id').val();
$.each($("input[name='isEmailSend']:checked"), function () {
selected.push($(this).val());
});
let jsonString = JSON.stringify(selected);
if (isHun) {
lengthError = 'Legalább 1 diákot ki kell választania!';
emailError = 'Sikertelen email küldés';
emailSuccess = 'Az emailek sikeresen el lettek küldve!';
} else {
lengthError = 'You must select at least 1 student.';
emailError = 'Failed to send email';
emailSuccess = 'Emails sent successfully.';
}
if (selected.length === 0) {
alert(lengthError);
return false;
}
$.ajax({
url: "process.php",
type: "post",
data: {
action: action,
course_id: course_id,
school_id: school_id,
selected: jsonString
},
dataType: 'json',
success: function (data) {
let msg = '';
let dataLen = data.length;
for (let i = 0; i < dataLen; i++) {
if (i === 0)
msg += data[i].email;
else
msg += ', ' + data[i].email;
}
if (msg !== "")
alert(emailError + ": " + msg);
else
alert(emailSuccess);
readEmailRecords();
},
error: function () {
$('#loading_gif').hide();
}
});
}
function createEmailrow(data) {
let no_result;
let dataLen = data.length;
let counter = 0;
if (isHun)
no_result = 'Nincs találat!';
else
no_result = 'No result found.';
$("#emailToStudents tr:not(:first)").remove();
for (let i = 0; i < dataLen; i++) {
let name = data[i].name;
let email = data[i].email;
let student_id = data[i].student_id;
let email_sent = data[i].email_sent;
let status = data[i].status;
if (email_sent === 0 && status === 1) {
$("#emailToStudents").append("<tr id='tr2_" + i + "'></tr>");
$("#tr2_" + i).append("<td><div class='custom-control custom-checkbox'><input id='defaultUnchecked_" + i + "' name='isEmailSend' class='email_ckbox custom-control-input' type='checkbox' value='" + student_id + "' onclick='checkCheckboxes()' /> <label class='custom-control-label' for='defaultUnchecked_" + i + "'></label></div></td>");
$("#tr2_" + i).append("<td>" + name + "</td>");
$("#tr2_" + i).append("<td>" + email + "</td>");
counter++;
}
}
if (counter === 0)
$("#emailToStudents").append("<tr><td>" + no_result + "</td><td></td><td></td><td></td><td></td></tr>");
}
function createTablerow(data) {
let no_result, edit, delete_user;
let dataLen = data.length;
let counter = 1;
if (isHun) {
no_result = 'Nincs találat!';
edit = 'Szerkesztés';
delete_user = 'Törlés';
} else {
no_result = 'No result found.';
edit = 'Edit';
delete_user = 'Delete';
}
$("#student_table tr:not(:first)").remove();
if (data === "empty") {
$("#student_table").append("<tr><td>" + no_result + "</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>");
$('#email_btn').attr("disabled", true);
$('#email_btn').addClass('inactive');
return;
}
$('#email_btn').attr("disabled", false);
$('#email_btn').removeClass('inactive');
$("#student_table").append("<tbody>");
for (let i = 0; i < dataLen; i++) {
let name = data[i].name;
let email = data[i].email;
let phone = data[i].phone;
let student_id = data[i].student_id;
let prPass = data[i].prPass;
let status = data[i].status;
let statusStr = getStudentStatus(status);
let stud_name = "'" + name + "'";
$("#student_table").append("<tr id='tr_" + i + "'></tr>");
$("#tr_" + i).append("<td>" + counter + "</td>");
$("#tr_" + i).append("<td>" + name + "</td>");
$("#tr_" + i).append("<td>" + email + "</td>");
$("#tr_" + i).append("<td>" + phone + "</td>");
$("#tr_" + i).append("<td>" + statusStr + "</td>");
$("#tr_" + i).append("<td>-" + prPass + "</td>");
$("#tr_" + i).append('<td><button class="btn btn-warning" onclick="GetUserDetails(' + student_id + ')">' + edit + '</button> <button class="btn btn-danger" onclick="DeleteUser(' + student_id + ', ' + stud_name + ')">' + delete_user + '</button></td>');
counter++;
}
$("#student_table").append("</tbody>");
}
function getStudentStatus(status) {
let passive, active, exam_passed;
let statusStr = '';
if (isHun) {
passive = 'Passzív';
active = 'Aktív';
exam_passed = 'Levizsgázott';
} else {
passive = 'Passive';
active = 'Active';
exam_passed = 'Passed the exam';
}
switch (status) {
case 0:
statusStr = passive;
break;
case 1:
statusStr = active;
break;
case 2:
statusStr = exam_passed;
break;
default:
break;
}
return statusStr;
}
function clearInputs() {
$('#name').val('');
$('#email').val('');
$('#email2').val('');
$('#phone').val('');
}
function showError(element, message) {
$(element).show();
$(element).html(message);
}
function hideError(element) {
if ($(element).is(":visible")) {
setTimeout(function () {
$(element).fadeOut(1000);
}, 3000);
}
}
// Add new user
function addRecord() {
let name = $('#name').val();
let email = $('#email').val();
let phone = $('#phone').val();
let schoolid = $('#school_id').val();
let course_id = $("#course").val();
let action = "create";
if (checkInput(action) === false) {
hideError("#error_div");
return false;
}
$.ajax({
url: "process.php",
type: "post",
data: {
name: name,
email: email,
phone: phone,
schoolid: schoolid,
course_id: course_id,
action: action
},
success: function (data) {
if (data.length > 0) {
showError("#error_div", JSON.parse(data));
hideError("#error_div");
} else {
readRecords();
clearInputs();
$("#error_div").hide();
}
},
error: function () {
$('#loading_gif').hide();
}
});
}
// Get the selected user's details
function GetUserDetails(editid) {
$('#hidden_user_id').val(editid);
let action = "details";
$.post("process.php", {
editid: editid,
action: action
}, function (data, status) {
let user = JSON.parse(data);
$('#updatename').val(user.name);
$('#updateemail').val(user.email);
$('#updateemail2').val(user.email);
$('#updatephone').val(user.phone);
$('#courses').val(user.course_id);
$('#status').val(user.status);
}
);
$('#editModal').modal("show");
}
// Update the selected user
function updateUserDetails() {
let name = $('#updatename').val();
let email = $('#updateemail').val();
let phone = $('#updatephone').val();
let hidden_user_id = $('#hidden_user_id').val();
let course_id = $('#courses').val();
let status = $('#status').val();
let action = "update";
let isDelete = "N";
if (status == 2) {
if (!isHun)
msg = "Do you want " + name + " to be removed from the list?";
else
msg = "Szeretné-e, ha a listából törlődne " + name + "?";
let conf = confirm(msg);
if (conf === true)
isDelete = "Y";
}
if (checkInput(action) === false) {
hideError("#error_div2");
return false;
}
$.post("process.php", {
name: name,
email: email,
phone: phone,
hidden_user_id: hidden_user_id,
course_id: course_id,
status: status,
isDelete: isDelete,
action: action
}, function () {
$("#editModal").modal("hide");
$("#error_div2").hide();
readRecords();
}
);
}
// Delete the selected user
function DeleteUser(deletedid, name) {
let msg = "";
let action = "delete";
if (!isHun)
msg = "Are you sure you want to delete the selected student: " + name + "?";
else
msg = "Csak abban az esetben törölje, ha a hallgató félbe hagyta a tanulmányait. Biztosan törölni szeretné a következő diákot: " + name + "?";
let conf = confirm(msg);
if (conf === true) {
$.ajax({
url: "process.php",
type: "post",
data: {
deletedid: deletedid,
action: action
},
success: function () {
readRecords();
},
error: function () {
$('#loading_gif').hide();
}
});
}
}
function readExcel() {
let filename = $('input[type=file]').val().split('\\').pop();
let ext = filename.split('.').pop();
let action = "excel_import";
let schoolid = $('#school_id').val();
let course_id = $("#course").val();
let file_data = $('#excl_file').prop('files')[0];
let form_data = new FormData();
if (ext !== 'xlsx') {
if (isHun) {
alert("Nem megfelelő a file formátuma!");
} else {
alert("Incorrect file format.");
}
return false;
}
form_data.append('file', file_data);
form_data.append('schoolid', schoolid);
form_data.append('course_id', course_id);
form_data.append('action', action);
$('#loading_gif').show();
$.ajax({
url: "process.php",
type: "post",
cache: false,
contentType: false,
processData: false,
data: form_data,
success: function (data) {
data = JSON.parse(data);
if (data.length > 0) {
let msg = "";
for (let i = 0; i < data.length; i++) msg += data[i] + "\n";
alert(msg);
}
$('#loading_gif').hide();
readRecords();
},
error: function () {
$('#loading_gif').hide();
}
});
}
function checkInput(action) {
let name, email, email2, phone, element, nameError, emailError, email2Error, phoneError, email1_2Error;
if (isHun) {
nameError = 'A név mező nincs kitöltve!';
emailError = 'Az email mező nincs kitöltve!';
email2Error = 'Az email mező nincs megerősítve!';
phoneError = 'A telefonszám mező nincs kitöltve!';
email1_2Error = 'A két email nem egyezik!';
} else {
nameError = 'Empty field: name.';
emailError = 'Empty field: email.';
email2Error = 'Empty field: confirm email.';
phoneError = 'Empty field: telephone.';
email1_2Error = 'The two emails do not match.';
}
if (action === 'create') {
name = $('#name').val();
email = $('#email').val();
email2 = $('#email2').val();
phone = $('#phone').val();
element = "#error_div";
} else if (action === 'update') {
name = $('#updatename').val();
email = $('#updateemail').val();
email2 = $('#updateemail2').val();
phone = $('#updatephone').val();
element = "#error_div2";
}
if (name === '') {
showError(element, nameError);
return false;
}
if (email === '') {
showError(element, emailError);
return false;
}
if (email2 === '') {
showError(element, email2Error);
return false;
}
if (phone === '' && isHun) {
showError(element, phoneError);
return false;
}
if (email !== email2) {
showError(element, email1_2Error);
return false;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

View File

@ -0,0 +1,19 @@
<?php
error_reporting(E_ERROR | E_PARSE);
if (!class_exists('Database')) require_once("../common_cadline_libraries/crm_database.class.php");
session_start();
$user_check = $_SESSION['username'];
$query = "SELECT id, name, username, password FROM `".CRMADATBAZIS."`.`schools` WHERE username = ?";
Database::getInstance()->query($query, array('s', $user_check));
$school = Database::getInstance()->fetchNext();
$login_session = $school['username'];
$school_id = $school['id'];
$school_name = $school['username'];
if (!isset($_SESSION['username'])) {
header("location:login");
die();
}
?>

View File

@ -0,0 +1,93 @@
<?php
if (version_compare(PHP_VERSION, '5.3.1', '<')) { die('Your host needs to use PHP 5.3.1 or higher to run this version of Joomla!'); }
define('_JEXEC', 1);
if (file_exists(__DIR__ . '/defines.php')) { include_once __DIR__ . '/defines.php'; }
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
$app = JFactory::getApplication('site'); // Instantiate the application.
jimport('joomla.plugin.helper');
require_once (JPATH_BASE .'/libraries/joomla/factory.php'); // JFactory
$credentials['username'] = trim($_POST['username']);
$credentials['password'] = trim($_POST['password']);
$credentials['serial'] = (int)$_POST['serial'];
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('id, password')
->from('#__users')
->where('username=' . $db->quote($credentials['username']));
$db->setQuery($query);
$result = $db->loadObject();
if ($result)
{
$match = JUserHelper::verifyPassword($credentials['password'], $result->password, $result->id);
if ($match === true)
{
$user = JUser::getInstance($result->id); // Bring this in line with the rest of the system
$error = $app->login($credentials); //perform the login action
$logged_user = JFactory::getUser();
$expire = time()+86400;
$db->setQuery('SELECT * FROM `panorama`.`user` WHERE serial='.$credentials['serial'].';');
$res = $db->loadObjectList();
$tomb=array(
'serial'=>$db->quote($credentials['serial']),
'nUserID'=>$db->quote($logged_user->nUserID),
'strName'=>$db->quote($logged_user->name),
'expire'=>$db->quote(date("Y-m-d H:i:s", $expire)),
);
if (empty($res)) // ha még egyáltalán nincs benne a széria szám
{
$query=$db->getQuery(true);
$query
->insert("`panorama`.`user`")
->columns($db->quoteName(array_keys($tomb)))
->values(implode(',', $tomb));
$db->setQuery($query);
$db->execute();
$result=$db->insertid();
}
else if ((int)$res[0]->nUserID==0) // ha facebook-al már be van jelentkezve
{
foreach ($tomb as $k=>$v) $values[]=$db->quoteName($k)."=".$v;
$query=$db->getQuery(true);
$query
->update("`panorama`.`user`")
->set($values)
->where(array('`id`='.$res[0]->id));
$db->setQuery($query);
$result=$db->execute();
}
setcookie("serial",$credentials['serial'],$expire,"/",".archlinexp.com");
//print_r($_COOKIE); die();
$app->redirect('http://panorama.archlinexp.com/auth/'.$credentials['serial']); //redirect logged in user
}
else
{
$app->redirect('http://panorama.archlinexp.com/auth/'.$credentials['serial'].'/invalid'); //redirect logged in user
}
}
else
{
die('Cound not find user in the database'); // Invalid user - Primitive error handling
}
?>

View File

@ -0,0 +1,30 @@
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
$privateKey = "3E9YY6E3pgGOGNEv30UFiF";
$publicKey = "2lBv1XQeEHJu5ptjgK5iVm";
$result = true;
for ($i = 1; $result == true && $i <= 100000; $i++) {
$data = generateRandomString(30);
$encoded = twk_encode($privateKey, $publicKey, $data);
$decoded = twk_decode($privateKey, $publicKey, $encoded);
$result = (strcmp($data,$decoded) == 0);
}
if($result)
echo "OK";
else
echo "not OK ".$i;
//print_r(twk_test());
//print_r(twk_encode("3E9YY6E3pgGOGNEv30UFiF", "2lBv1XQeEHJu5ptjgK5iVm", "123456789"));
?>

View File

@ -0,0 +1,4 @@
<?php
$a = 23;
print $a;
?>

View File

@ -0,0 +1,277 @@
<?php
/*
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* http://recaptcha.net/plugins/php/
* - Get a reCAPTCHA API Key
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
* AUTHORS:
* Mike Crawford
* Ben Maurer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* The reCAPTCHA server URL's
*/
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
/**
* Encodes the given data into a query string format
* @param $data - array of string elements to be encoded
* @return string - encoded request
*/
function _recaptcha_qsencode ($data) {
$req = "";
foreach ( $data as $key => $value )
$req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
// Cut the last '&'
$req=substr($req,0,strlen($req)-1);
return $req;
}
/**
* Submits an HTTP POST to a reCAPTCHA server
* @param string $host
* @param string $path
* @param array $data
* @param int port
* @return array response
*/
function _recaptcha_http_post($host, $path, $data, $port = 80) {
$req = _recaptcha_qsencode ($data);
$http_request = "POST $path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
$http_request .= "\r\n";
$http_request .= $req;
$response = '';
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
die ('Could not open socket');
}
fwrite($fs, $http_request);
while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs);
$response = explode("\r\n\r\n", $response, 2);
return $response;
}
/**
* Gets the challenge HTML (javascript and non-javascript version).
* This is called from the browser, and the resulting reCAPTCHA HTML widget
* is embedded within the HTML form it was called from.
* @param string $pubkey A public key for reCAPTCHA
* @param string $error The error given by reCAPTCHA (optional, default is null)
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
* @return string - The HTML to be embedded in the user's form.
*/
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
{
if ($pubkey == null || $pubkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($use_ssl) {
$server = RECAPTCHA_API_SECURE_SERVER;
} else {
$server = RECAPTCHA_API_SERVER;
}
$errorpart = "";
if ($error) {
$errorpart = "&amp;error=" . $error;
}
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
<noscript>
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>';
}
/**
* A ReCaptchaResponse is returned from recaptcha_check_answer()
*/
class ReCaptchaResponse {
var $is_valid;
var $error;
}
/**
* Calls an HTTP POST function to verify if the user's guess was correct
* @param string $privkey
* @param string $remoteip
* @param string $challenge
* @param string $response
* @param array $extra_params an array of extra variables to post to the server
* @return ReCaptchaResponse
*/
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
{
if ($privkey == null || $privkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($remoteip == null || $remoteip == '') {
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
}
//discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
$recaptcha_response = new ReCaptchaResponse();
$recaptcha_response->is_valid = false;
$recaptcha_response->error = 'incorrect-captcha-sol';
return $recaptcha_response;
}
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
array (
'privatekey' => $privkey,
'remoteip' => $remoteip,
'challenge' => $challenge,
'response' => $response
) + $extra_params
);
$answers = explode ("\n", $response [1]);
$recaptcha_response = new ReCaptchaResponse();
if (trim ($answers [0]) == 'true') {
$recaptcha_response->is_valid = true;
}
else {
$recaptcha_response->is_valid = false;
$recaptcha_response->error = $answers [1];
}
return $recaptcha_response;
}
/**
* gets a URL where the user can sign up for reCAPTCHA. If your application
* has a configuration page where you enter a key, you should provide a link
* using this function.
* @param string $domain The domain where the page is hosted
* @param string $appname The name of your application
*/
function recaptcha_get_signup_url ($domain = null, $appname = null) {
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
}
function _recaptcha_aes_pad($val) {
$block_size = 16;
$numpad = $block_size - (strlen ($val) % $block_size);
return str_pad($val, strlen ($val) + $numpad, chr($numpad));
}
/* Mailhide related code */
function _recaptcha_aes_encrypt($val,$ky) {
if (! function_exists ("mcrypt_encrypt")) {
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
}
$mode=MCRYPT_MODE_CBC;
$enc=MCRYPT_RIJNDAEL_128;
$val=_recaptcha_aes_pad($val);
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
}
function _recaptcha_mailhide_urlbase64 ($x) {
return strtr(base64_encode ($x), '+/', '-_');
}
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
}
$ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
}
/**
* gets the parts of the email to expose to the user.
* eg, given johndoe@example,com return ["john", "example.com"].
* the email is then displayed as john...@example.com
*/
function _recaptcha_mailhide_email_parts ($email) {
$arr = preg_split("/@/", $email );
if (strlen ($arr[0]) <= 4) {
$arr[0] = substr ($arr[0], 0, 1);
} else if (strlen ($arr[0]) <= 6) {
$arr[0] = substr ($arr[0], 0, 3);
} else {
$arr[0] = substr ($arr[0], 0, 4);
}
return $arr;
}
/**
* Gets html to display an email address given a public an private key.
* to get a key, go to:
*
* http://www.google.com/recaptcha/mailhide/apikey
*/
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
$emailparts = _recaptcha_mailhide_email_parts ($email);
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
}
?>

476
cadline/docroot/tips.php Normal file
View File

@ -0,0 +1,476 @@
<?php
/*******************************************************************************
* eredeti url: http://www.archlinexp.com/index.php?menu=tips2012&lang=hun&version=1&session=OTA0NkEzMTlBMDcwQTE3NkE4NzRBMzc1QTc3NkEwNzJBNTc0Q0Y3NUE3NzdBMjdGQTc3RUE4NzJBNDcwQTgxOUNGNzVDRjc3QTA3NkEyNzdBMzZCQTM3MEJENzVBNTA3QkQ3MkEwN0ZBMDAzQTYxOUEyNjhBOTY4QTA3NEJFNzZCRTc3RTIyMUY1MjNCRTI4QTE3N0E4NzE=
* eredeti url: http://old.archlinexp.com/tips/tips2009/hun/1/OTA0NkEzMTlBMDcwQTE3NkE4NzRBMzc1QTc3NkEwNzJBNTc0Q0Y3NUE3NzdBMjdGQTc3RUE4NzJBNDcwQTgxOUNGNzVDRjc3QTA3NkEyNzdBMzZCQTM3MEJENzVBNTA3QkQ3MkEwN0ZBMDAzQTYxOUEyNjhBOTY4QTA3NEJFNzZCRTc3RTIyMUY1MjNCRTI4QTE3N0E4NzE=/46.139.109.235
* új url: http://www.archlinexp.com/maintenance/tips.php?lang=hun&version=2&session=OTA0NkEzMTlBMDcwQTE3NkE4NzRBMzc1QTc3NkEwNzJBNTc0Q0Y3NUE3NzdBMjdGQTc3RUE4NzJBNDcwQTgxOUNGNzVDRjc3QTA3NkEyNzdBMzZCQTM3MEJENzVBNTA3QkQ3MkEwN0ZBMDAzQTYxOUEyNjhBOTY4QTA3NEJFNzZCRTc3RTIyMUY1MjNCRTI4QTE3N0E4NzE=
* logfilter=0 - csak a legfontosabb logok;
* logfilter=10 - minden logot küld;
******************************************************************************/
//die();
if (!class_exists('crm_hardlock')) require_once("/var/www/hosting/archline.hu/sub/common_cadline_libraries/crm_hardlock.class.php");
if (!class_exists('crm_users')) require_once("/var/www/hosting/archline.hu/sub/common_cadline_libraries/crm_users.class.php");
error_log(print_r($_GET,TRUE),3,"../tmp/error_tips.log");
$user_lang_db = $user_lang = $origlang = (isset($_GET['lang']) && empty($_GET['lang']) == false) ? trim($_GET['lang']) : 'eng';
//-$user_version = (isset($_GET['version']) && empty($_GET['version']) == false ? trim($_GET['version']) : NULL); nem ahsznalt valtozo volt, kivettem 2019-ben
$user_ssID = (isset($_GET['session']) && empty($_GET['session']) == false ? trim($_GET['session']) : NULL);
$user_IP = $_SERVER['REMOTE_ADDR'];
$time=time();
//get country name from ip
$locale=@file_get_contents("http://freegeoip.net/xml/".$user_IP,FALSE, stream_context_create(array('http'=>array('timeout'=>2)) ) );
$tomb = json_decode(json_encode(simplexml_load_string($locale)),TRUE);
$ctrname=$tomb["CountryName"];
$temp=explode(".", gethostbyaddr($user_IP));
if(!isset($ctrname) || $ctrname=='')
$ctrname = 'unknown';
if(!isset($user_ssID) || $user_ssID==''){
$rec=array(
'hiba'=>"Tips.php: unknown tips data\n",
'datum'=>date('Y-m-d H:i:s',time()));
crm_database::getInstance()->insert('a_hibak',$rec);
return; //- ha nincs meg a kodolt stream, akkor semmilyen infor
}
$str_decoded = base64_decode($user_ssID); //decode the session string
sscanf(substr($str_decoded,0,4),'%04x',$keyDec);
$encoded = str_split(substr($str_decoded,4),4);
$decoded = '';
foreach($encoded as $e) {
sscanf($e,'%04x',$temp);
if(strlen(substr(sprintf('%x',$temp^$keyDec),2))>0) {
$decoded .= chr(hexdec(substr(sprintf('%04x',$temp^$keyDec),2)));
$decoded .= chr(hexdec(substr(sprintf('%04x',$temp^$keyDec),0,2)));
} else {
$decoded .= chr(hexdec(substr(sprintf('%04x',$temp^$keyDec),2)));
}
}
$pos = strpos($decoded, '#'); //ba 2018.07.04. atterunk a # separatorra. Ezidaig nem fordulhatott elo benne ilyen jel
if($pos === false)
$separator = '_';
else
$separator = '#';
$numdata = substr_count($decoded, $separator); //ba most már kapunk adatot az oprendszerrol is
$osdata = '';
$reactivationCounter = 0;
if( $numdata >= 11 )
list($empty, $pwd, $compID, $build, $ctrID, $telepitesikod, $osdata, $usGCMan, $usGCType, $usGCDriverVer, $npID, $partnerID, $name, $email, $company, $phone, $newsletter, $reactivationCounter) = split($separator, $decoded);
elseif( $numdata >= 6 )
list($empty, $pwd, $compID, $build, $ctrID, $telepitesikod, $osdata, $usGCMan, $usGCType, $usGCDriverVer, $npID, $partnerID) = split($separator, $decoded);
else
list($empty, $pwd, $compID, $build, $ctrID, $telepitesikod) = split($separator, $decoded);
$crackedProgram = strpos($osdata, ".gray.") !== false ? true : false;
if($crackedProgram){ //- 2018-as proragramoktol(nehany 2018-as build nem fut ide be)
/*$crackedProgramDeactivated = false;
if(crm_hardlock::IsCalledFromMyIP()){
header('Content-Type: text/xml; charset=utf-8');
header('Content-Disposition: inline; filename=response.xml');
print '<'.'?'.'xml version="1.0" encoding="UTF-8" standalone="yes"'.'?'.'>
<Tips>
<Tip lang="en" version="2">
<path>/public/support/tips/en/</path>
</Tip>
<actcode>'.$validTelepitesikod.'</actcode>
<Virtualization>true</Virtualization>
<logfilter>0</logfilter>
<loginEnabled>false</loginEnabled>
<PersonalMessage></PersonalMessage>
<graylink></graylink>
</Tips>';
$crackedProgramDeactivated = true;
}*/
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$message = "Crack: ".$decoded." || url: ".$actual_link;
crm_hardlock::AddToDebugTable($message);
return; // A crackelt programokat nem taroljuk
}
$validPassword = crm_hardlock::IsValidPassword($pwd);
if($validPassword){
$verid=crm_hardlock::GetVeridFromPassword($pwd);
$softwareKey = crm_hardlock::IsSoftwareKey($pwd); // Software kulcs 2019
if(crm_hardlock::IsProgramExpiredByFixDate($pwd)) {
$message = "Tip error: expired program by IsProgramExpiredByFixDate || password: ".$pwd;
crm_hardlock::AddToDebugTable($message);
return;
}
} else {
$verid = 0;
$softwareKey = false;
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$message = "Tip error: invalid password || password: ".$pwd." || url: ".$actual_link;
crm_hardlock::AddToDebugTable($message);
return;
}
$validTelepitesikod = crm_hardlock::IsValidTimeCode($telepitesikod);
if($validTelepitesikod || ($validPassword && $softwareKey == false) ) //- hardware kulcseseten az isid a passwordbol generalhato
$isid=($softwareKey ? crm_hardlock::GetIsidFromTimeCode($telepitesikod) : substr($pwd,0,2).$verid);
else {
$telepitesikod = "";
$isid = "";
}
if($validPassword == false && substr($decoded,0,2) == "##"){ //- 2018-as proragramoktol(nehany 2018-as build nem fut ide be)
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$message = "Tip error: missing password || url: ".$actual_link;
crm_hardlock::AddToDebugTable($message);
}
if($validPassword && $validTelepitesikod == false && $verid > 35){ //- csak a 2019-es programokat es ujabbakat vizsgalunk, a regbbiekben elofordulhatnak hibas idokodok
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$message = "Tip error: invalid timecode ".$decoded." || url: ".$actual_link;
crm_hardlock::AddToDebugTable($message);
}
if(isset($npID))
$compid = crm_hardlock::AddOrUpdateComputer($npID, ''); // $comp_name = base64_decode($comp_name); // Ez meg nem jon be!
$isNamirialAutoCreate = isset($npID) && $npID>'' && isset($partnerID) && $partnerID=='2nt' /*-&& isset($telepitesikod) && $telepitesikod>''-*/ && $validPassword;
$isBimLadderAutoCreate = isset($npID) && $npID>'' && isset($partnerID) && $partnerID=='kbl' /*-&& isset($telepitesikod) && $telepitesikod>''-*/ && $validPassword;
/*******************************************************************************
*NAMIRIAL vagy BIMLADDER automata kulcskiadás és program létrehozás
******************************************************************************/
if ($isNamirialAutoCreate || $isBimLadderAutoCreate) {
$queryStr = "SELECT * FROM `".CRMADATBAZIS."`.`nonprofit` WHERE computer_id='".$compid."' AND partnerID = '".$partnerID."' AND verID =".$verid." LIMIT 1;";
crm_database::getInstance()->query($queryStr);
$res=crm_database::getInstance()->fetchAssoc();
$rangeMin = $isNamirialAutoCreate ? 940001 : 920001;
$rangeMax = $isNamirialAutoCreate ? 949999 : 929999;
$interval = $isNamirialAutoCreate ? 90 : 30;
$country_id = $isNamirialAutoCreate ? 39 : 82;
$topic_id = $isNamirialAutoCreate ? 366 : 368;
$info = $isNamirialAutoCreate ? 'Namirial nonprofit kulcs aktiválás' : 'BIMLadder nonprofit kulcs aktiválás';
$contact = $isNamirialAutoCreate ? 8 : 9;
$type=crm_hardlock::GetTypeFromPassword($pwd);
$ver=crm_hardlock::GetVersion(array('verPassword8and9'=>$verid));
//ba nincs ehhez a gephez meg non-profit program regisztralva
if (empty($res)) {
$hlNum=crm_hardlock::GetTheFirstNotUsedHlNumFromInterval($rangeMin,$rangeMax);
$pass=crm_hardlock::GeneratePassword($hlNum,0,$type,$ver['verCode']);
$aktKod=crm_hardlock::GenerateTimeCode($pass,$isid,$interval);
// Ha nincs benne a user a CRM-be, akkor hozza adjuk
$userID=crm_users::addUser(array(
'strName'=>$name,
'strEMail'=>$email,
'strTel'=>$phone,
'nCtrID'=>$country_id,
'old_db'=>'clusers_eng',
'dateInsert'=>$time,
'strCompany'=>$company
), $newsletter);
//ba regisztraljuk hozza a non-profit programot
crm_hardlock::AddNonprofit(array(
'isid'=>$isid,
'verid'=>$verid,
'hlID'=>$hlNum,
'nUserID'=>$userID,
'add_datetime'=>date('Y-m-d H:i:s',$time),
'expire_datetime'=>date('Y-m-d H:i:s', strtotime('+90 day', $time)),
'activation_datetime'=>date('Y-m-d H:i:s',$time),
'old_db'=>'clusers_eng',
'partnerID'=>$partnerID,
'enabled'=>'Y',
'computer_id'=>$compid
));
//Namirial vagy BIMLADDER non-profit kod aktivalas beszurasa crm -> u_history tablaba
crm_users::AddUserHistory(array(
'nUserID'=>$userID,
'nTopicID'=>$topic_id,
'dateEvent'=>date('Y-m-d H:i:s',$time),
'strPlace'=>'',
'strInfo'=>$info,
'nManagerID'=>36,
'insertDate'=>date('Y-m-d H:i:s',$time)
));
crm_hardlock::AddHardlock(array(
'hlNum'=>$hlNum,
'hlCtrID'=>$country_id,
'hlLan'=>0,
'hlStat'=>1,
'hlDateIssue'=>date('Y-m-d',$time),
'hlManID'=>36,
'hlTime'=>date('Y-m-d H:i:s',$time),
'hlUser'=>$userID,
'hlDealer'=>62103,
'bUjithato'=>1,
'old_db'=>'clusers_eng'
));
crm_hardlock::AddProgram(array(
'prTypeID'=>$type,
'prVerID'=>$ver['verID'],
'prLan'=>0,
'prPass'=>trim($pass),
'prSellDate'=>date('Y-m-d',$time),
'prActDate'=>date('Y-m-d',$time+$interval*86400), // 90 vagy 30 nap
'prFizetve'=>date('Y-m-d',$time+$interval*86400),
'prActCode'=>trim($aktKod),
'prTime'=>date('Y-m-d H:i:s',$time),
'prLastMod'=>date('Y-m-d H:i:s',$time),
'prContact'=>$contact, // Non-profit
'prHlNum'=>$hlNum, // 99xxxx
'prManID'=>36, // web
'prStat'=>0,
'prHiType'=>1 // 1 Rendelés | 2 Tipus Valtas | 3 Frissites | 4 Auto Friss.
));
$pwd = $pass; //ba 2018.07.02. mostantol az uj jelszava a usernek a most generalt, 94-es lesz, nem pedig a 93-as!
} else {
//ba ehhez a gephez mar volt non-profit regisztracio, keressuk ki a sorozatszamot neki
$hlNum = $res[0]['hlID'];
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE prHlNum='{$hlNum}' limit 1");
$programQuery=crm_database::getInstance()->fetchAssoc();
$pwd = $programQuery[0]['prPass'];
}
} //- if ($isNamirialAutoCreate || $isBimLadderAutoCreate) vege
$hlNum = crm_hardlock::GetHlnumFromPassword($pwd);
//insert stats to the userstats table
$stats = array(
'usLang' => $user_lang_db,
'usDate' => time(),
'usPwd' => $pwd,
'usVer'=>$verid,
'usCompID' => $compID,
'usCtrID' => $ctrID,
'usBuild' => $build,
'usCtrName' => $ctrname,
'usIP' => $user_IP,
'usOSData' => $osdata,
'usISID' => $isid,
'usInditasokSzama' => 1
);
crm_database::getInstance()->query("SELECT hlLan, hlCtrID FROM `".CRMADATBAZIS."`.`hardlock` WHERE hlNum='".$hlNum."'");
$hardlock = crm_database::getInstance()->fetchAssoc();
$isLanProgram = empty($hardlock) == false && $hardlock[0]['hlLan'] > 0;
// A szarmazasi orszag beallitasa
if($softwareKey) {
$liveKey = crm_hardlock::IsLiveKey($pwd); // Live kulcs 2019
if(empty($hardlock) == false && ($liveKey || in_array(substr($pwd,0,2), array('99','98','95'))) ) { // Azok a programok, amik regisztrálódnak a CRM-ben 2019
$hl=$hardlock[0];
if(isset($hl['hlCtrID']))
$stats['usHlCtrID'] = $hl['hlCtrID'];
}
} else {
$stats['usHlCtrID'] = substr($pwd,0,2);
}
$trialProgram = crm_hardlock::IsTrialKey($pwd);
$trialSpecialEditionProgram = $trialProgram ? crm_hardlock::IsSpecialEditionTrial($pwd) : false;
// Kereskedelmi valtozatok lekezelese (a statisztika miatt bekerulnek a Namirial es a BIMLadder programok is)
if($verid>29 && ($trialProgram == false || $trialSpecialEditionProgram)) {
if($trialSpecialEditionProgram == false) {
$query = "SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE prPass='".$pwd."'";
if($softwareKey && $isLanProgram) //- szoftveres lan kulcsnal mindig telepitesenkent egyedi az aktivalo kod
$query .= " AND prActCode LIKE '%-".$isid."-%'";
$query .= ";";
crm_database::getInstance()->query($query);
$prgrm=crm_database::getInstance()->fetchAssoc();
if(empty($prgrm) && $softwareKey && $isLanProgram) { //- a lan-os valtozatnal na nem volt telepitve lehet, hogy nem volt talalat
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE prPass='".$pwd."' and (prActCode = '' or prActCode is null) LIMIT 1;");
$prgrm=crm_database::getInstance()->fetchAssoc();
}
}
if($softwareKey) { //- a telepitesi datum frissitese
if($validTelepitesikod) {
//- telepitesi datum tarolasanak elokeszitese
$telepitesota_eltelt_napok_szama = crm_hardlock::GetDayFromTimeCode($telepitesikod);
$date = new DateTime(date("Y-m-d"));
$date->modify('-'.$telepitesota_eltelt_napok_szama.' day');
$installDate = $date->format('Y-m-d');
} else
$installDate = time();
} else {
if(empty($prgrm)) {
$installDate = time();
//- todo ez gigantikus hiba, jelezni kell, ha ilyen elofordul
} else
$installDate = $prgrm[0]['prSellDate'];
}
$stats['usTelepitesiDatum'] = $installDate;
if(empty($prgrm) == false)
$jelenlegi_aktivalokod = $prgrm[0]['prActCode'];
else
$jelenlegi_aktivalokod = '';
// A userstats2013 tablaba megkeresi az utolso bejegyzest és amennyiben valtozatlan, updateli az inditasok szamat, különben uj bejegyzést hoz letre
if($trialSpecialEditionProgram == false) {
//- idokod generalasa
$aktivalokod = crm_hardlock::GetOrGenerateTimeCode($pwd,$isid,$telepitesikod);
$usstatid = crm_hardlock::UpdateInstallationDate($pwd, $compID, $build, $aktivalokod, $user_IP, $installDate, $stats);
// Nonprofit regisztracio beirasa a user-hez
crm_database::getInstance()->query("SELECT hlStat,hlUser FROM `".CRMADATBAZIS."`.`hardlock` WHERE hlNum='".$hlNum."'");
$res=crm_database::getInstance()->fetchAssoc();
$kulcs=$res[0];
if (in_array((int)substr($pwd,0,3),array(995,996,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989)) && (int)$kulcs['hlUser']>0) { // nonprofitos program első indítása
// TODO: Megakasztotta a programinditasokat!!! 2019.08.28. SQL HIBA
/*crm_database::getInstance()->query("SELECT COUNT(*) AS `darab` FROM `".CRMADATBAZIS."`.`h_aktivalas_infok` WHERE kulcs='".$hlNum."';");
$tmp=crm_database::getInstance()->fetchAssoc();
$darab=(int)$tmp[0]['darab'];*/
crm_database::getInstance()->query("SELECT COUNT(*) AS `darab` FROM `".CRMADATBAZIS."`.`u_history` WHERE `nUserID`=".(int)$kulcs['hlUser']." AND nTopicID IN (314,315);");
$tmp=crm_database::getInstance()->fetchAssoc();
$esem=(int)$tmp[0]['darab'];
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`users` WHERE nUserID='".(int)$kulcs['hlUser']."';");
$usr=crm_database::getInstance()->fetchAssoc();
$usr=$usr[0];
if (!empty($usr) && (/*$darab==0 ||*/ $esem==0)) {
crm_database::getInstance()->insert("`".CRMADATBAZIS."`.`u_history`",array(
'nUserID'=>(int)$kulcs['hlUser'],
'nTopicID'=>($usr['old_db']=='clusers' ? 314 : 315),
'dateEvent'=>date('Y-m-d'),
'strPlace'=>'web',
'strInfo'=>($usr['old_db']=='clusers' ? 'Non-profit kód regisztráció' : 'Non-profit code registration').': '.$hlNum,
'nManagerID'=>36,
'insertDate'=>date('Y-m-d H:i:s')
));
}
}
} else
$usstatid = crm_hardlock::UpdateInstallationDate($pwd, $compID, $build, $jelenlegi_aktivalokod, $user_IP, $installDate, $stats);
$virtualization = ($kulcs['hlStat']=='2' ? "false" : "true"); // letiltott kulcs visszajelzése a programnak
$valasz = ($aktivalokod!="") ? $aktivalokod : "(( nem kapott valaszt ))";
// TODO: Megakasztotta a programinditasokat!!! 2019.08.28. SQL HIBA
/*crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_aktivalas_infok` WHERE leiras LIKE 'programinditas -pw: ".$pwd."%' ORDER BY datum desc LIMIT 1;");
$res=crm_database::getInstance()->fetchAssoc();
if(empty($res) == false)
crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`h_aktivalas_infok` SET leiras='programinditas - pw: {$pwd}, build: {$build}, isid: {$isid}, időkód: {$telepitesikod}, valasz: ".$valasz."', datum='". time()."' WHERE id=".$res[0]['id']." LIMIT 1");
else
crm_hardlock::_Hibajelento("tips",substr($pwd,0,6),"programinditas - pw: {$pwd}, build: {$build}, isid: {$isid}, időkód: {$telepitesikod}, valasz: ".$valasz,(isset($arrGCData)?$arrGCData:array()),(isset($usstatid)?$usstatid:NULL));*/
}
// Tavoli logolasi parameterek beallitasa
$logfilter=0;
if ($validPassword && $crackedProgram == false && $trialProgram == false) {
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE `prPass`='".$pwd."' LIMIT 1;");
$res=crm_database::getInstance()->fetchAssoc();
$logfilter=$res[0]['prLogFilter'];
}
// Ha a verid >= 36, akkor beinsertalja a hardlockot és a computer id-t a hardlock_computers tablaba, ha meg nincs benne
if($softwareKey && $crackedProgram == false && $trialProgram == false)
crm_hardlock::AddHardlockComputer($hlNum, $compid, $verid);
// Kulcsok tesztelese
if($softwareKey && $crackedProgram == false && $trialProgram == false) {
$valasz = crm_hardlock::sCheckPassword($pwd);
if(empty($valasz) == false) {
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$message = "Checked Password || Serial: ".$pwd." || Valasz: ".$valasz." || url: ".$actual_link;
crm_hardlock::AddToDebugTable($message);
}
}
// Modul es reaktivalo kodok kiiratasa
if($crackedProgram == false && $trialProgram == false) {
// Modul kodok osszegyujtese
crm_database::getInstance()->query("SELECT prID FROM `".CRMADATBAZIS."`.`h_programs` WHERE `prPass`='".$pwd."' LIMIT 1;");
$programs = crm_database::getInstance()->fetchAssoc();
$moduleList = "";
if(empty($programs) == false) {
$prID = $programs[0]['prID'];
crm_database::getInstance()->query("SELECT mdCode FROM `".CRMADATBAZIS."`.`p_modules` WHERE `mdPrID`='".$prID."'");
$modules = crm_database::getInstance()->fetchAssoc();
foreach ($modules as $module) {
if(empty($moduleList) == false)
$moduleList .= ";";
$moduleList .= $module['mdCode'];
}
}
// Reaktivalokodok kuldese
if($virtualization == "true" && $reactivationCounter > 0) {
$reactivationCounter--;
$modulIsid = substr($pwd, 0,2).$verid;
if($reactivationCounter > 4) // 5-nel tobb nem lehet
$reactivationCounter = 4;
for($i=0; $i<=$reactivationCounter; $i++) {
$modulID = 35+$i;
$reactivationCode = crm_hardlock::GenerateTimeCode($pwd, $modulIsid, $modulID);
if(empty($moduleList) == false)
$moduleList .= ";";
$moduleList .= $reactivationCode;
}
}
}
if(crm_hardlock::IsCalledFromMyIP() && $softwareKey) {
$utst = time();
(int)$convertedDay = crm_hardlock::ConvertDay(date('w'));
$tid = (int)($utst / $convertedDay);
crm_database::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`p_serial_isid` WHERE serial='".$pwd."' AND isid='".$isid."' AND aktiv = 1");
$p_serial_isid=crm_database::getInstance()->fetchAssoc();
if(empty($p_serial_isid))
$regenr = crm_hardlock::No($utst, 39);
else
$regenr = crm_hardlock::Yes($utst, 39);
}
header('Content-Type: text/xml; charset=utf-8');
header('Content-Disposition: inline; filename=response.xml');
print '<'.'?'.'xml version="1.0" encoding="UTF-8" standalone="yes"'.'?'.'>
<Tips>
<Tip lang="en" version="2">
<path>/public/support/tips/en/</path>
</Tip>
'.((isset($aktivalokod) && $aktivalokod) ? '<actcode>'.$aktivalokod.'</actcode>' : '').'
'.((isset($virtualization) && $virtualization) ? '<Virtualization>'.$virtualization.'</Virtualization>' : '').'
'.((isset($usstatid) && (int)$usstatid>0) ? '<actid>'.(int)$usstatid.'</actid>' : '').'
<logfilter>'.$logfilter.'</logfilter>
'.((empty($moduleList) == false) ? '<Modules>'.$moduleList.'</Modules>' : '').'
<loginEnabled>'.($hlNum=='360006' ? 'true' : 'false').'</loginEnabled>
'.((isset($regenr) && (int)$regenr>0) ? '<regnr>'.(int)$regenr.'</regnr>' : '').'
'.((isset($tid) && (int)$tid>0) ? '<tid>'.(int)$tid.'</tid>' : '').'
</Tips>';
?>