www.archline.hu — clean post-compromise baseline #1

Closed
imre.agent wants to merge 0 commits from baseline-build/47 into main
2575 changed files with 381645 additions and 379654 deletions

21
.gitattributes vendored
View File

@ -1,21 +0,0 @@
# Determinisztikus sorvég (illusion3-salt#895 CRLF-incidens): a baseline
# byte-pontossága a source-of-truth LF-jén múlik, NEM a build-kliens
# core.autocrlf-jén. A build-baseline.sh shebangja CRLF esetén 'bash\r'-t
# keresett és eltört; a build out/ CRLF-je pedig a baseline-diffet rontja.
* text=auto eol=lf
# bináris assetek — a git ne konvertáljon, byte-pontos marad
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.webp binary
*.woff binary
*.woff2 binary
*.ttf binary
*.eot binary
*.otf binary
*.zip binary
*.gz binary
*.pdf binary
*.swf binary

2
.gitmodules vendored
View File

@ -1,8 +1,6 @@
[submodule "cadline/backend/common_cadline_libraries"]
path = cadline/backend/common_cadline_libraries
url = ssh://git@git.cadline.hu:22222/cadline_web/cadcommonlib.git
branch = master
[submodule "cadline/backend/maintenance"]
path = cadline/backend/maintenance
url = ssh://git@git.cadline.hu:22222/cadline_web/maintenance.git
branch = master

127
AGENTS.md
View File

@ -1,127 +0,0 @@
# AGENTS.md — machine-facing rules for this repo
**Read this before touching anything.** `README.md` explains the project to a human;
this file states the rules an automated agent must follow. Where the two seem to
disagree, this file wins for process questions.
---
## 1. What this repo is
It produces **clean, deployable code baselines** for the Cadline web sites hosted on
`tanis.cadline.hu`. A baseline serves two purposes at once:
1. the **known-good reference** the HIDS baseline-diff compares the live docroot against;
2. the **source of truth for deployment** — the tree that will be pushed to the server,
replacing direct editing on the live host.
The repo stores baseline **constituents plus a generator**, never the deployed tree.
`build-baseline.sh` assembles `out/` deterministically; `out/` is git-ignored.
## 2. One site per branch
There is **no per-site repo**. Sites and CMS versions are separated by **git branch**:
| Branch | Site | CMS core |
|---|---|---|
| `main` | www.archline.hu | Joomla 3.8.11 |
| `site/archlinexp.eu` | www.archlinexp.eu | Joomla 3.9.2 |
`build-baseline.sh` is **site-agnostic**: it walks `core/`, `packages/`, `deployed/`,
`cadline/`, `overrides/` and contains no site-specific logic. A new site means a new
branch with different *content*, **not** a modified script. If you find yourself editing
the generator to special-case a site, stop — that is the wrong branch of the design.
Site branches are **parallel and long-lived**. They do **not** merge into `main`.
Only repo-wide things (this file, `README.md`, the generator, `lib/`) belong on `main`.
## 3. The cardinal rule: never build a baseline from an infected tree
Every one of these sites is or was compromised. A baseline built by copying the live
docroot **would cement the malware into the reference and into every future deploy**.
Therefore:
- Take the CMS core from the **official upstream package**, never from live.
- Take the site's own code from the **developer source repo**
(`git.cadline.hu/cadline/websource`, per-site subdirectory), never from live.
- Only for extensions with **no obtainable upstream** may files come from live — and
then they are *vetted*, not trusted.
- **The build output must be double-checked before it is used.** This is not optional:
the archline baseline's first candidate contained 34 malware files, and only the
double-check caught them.
## 4. Mandatory verification (do not skip, do not weaken)
After every build, run all of these against `out/`:
1. **YARA** with the operator's ruleset. Expected: **zero** hits.
2. **IOC paths**: not one entry of `malware-iocs.paths` may exist under `out/`.
3. **Disguise sweep**: no `*.php.json`, `*.phar*`, `*.phtml*`, `_h3x_*`; no `.json` file
containing a PHP open tag.
4. **Structural check** — the rule that catches what content matching misses:
> An extra file on a **CMS core component path** that is **not** a template override
> (`templates/<tpl>/html/...`) is **not a module**. It is a leftover or a plant.
Diff `out/` against the vanilla package: for every path under a core component that
the vanilla does not have, decide explicitly. This rule found a file-write webshell
(`components/com_mailto/mail.php`) and an Akeeba Kickstart leftover carrying a
password — **both invisible to YARA**.
5. **Core version**: assert the built `libraries/src/Version.php` is the intended release.
A contaminated baseline must **never** be shipped. If verification fails, fix the
constituents and rebuild — do not filter the symptom out of `out/`.
## 5. Repository boundary (hard rule)
This repo lives on **`git.cadline.hu`** — the customer's Gitea, a different server from
the operator's. Therefore:
- **Never reference the operator's infrastructure here.** No operator issue URLs, no
operator hostnames, no `Addresses-Issue:` trailers pointing at operator trackers —
not in files, not in commit messages, not in branch names.
- Issue tracking for this work lives on the operator side and is **not** linked from
here. Describe *what* and *why* in the commit message itself instead.
- An `@illusion.hu` e-mail address in a commit trailer (authorship attribution) is the
one accepted exception.
## 6. Commits and branches
- Conventional Commits, **English**, subject ≤72 chars, imperative mood.
- Trailer: `Assisted-by: claude-code@<model>` on AI-assisted commits.
- **No** `Addresses-Issue:` / `Closes` (see §5).
- Never force-push a branch someone else may be building on; on your own fresh branch it
is fine (use `--force-with-lease`).
- **Never push to `main`.** Open a pull request; a human merges.
- **Never commit a secret.** These trees legitimately contain third-party code with
embedded credentials — if you must refer to one, cite `file:line` and the *type*, never
the value. Redaction applies to commit messages, docs and any output you produce.
## 7. Layer semantics (what goes where)
| Directory | Holds | Source of truth |
|---|---|---|
| `core/` | CMS official package, deployed form, installer removed | upstream vendor |
| `packages/<slug>/` | extensions with obtainable upstream; modified ones authored as two commits (pristine → delta) so `git diff` documents our change | upstream + our patch |
| `deployed/<slug>/` | extensions with **no** obtainable upstream: vetted live files | live (vetted) |
| `cadline/<slug>/` | the site's own code | developer source repo |
| `overrides/` | the site's modifications to core files, **on the current core's base** | developer source |
| `malware-iocs.paths` | paths excluded from the build (droppers, leftovers) | this repo |
`overrides/` rsyncs **last**, so it wins over `core/`.
**Do not take a customized core file from live.** The updater skips customized files, so
the live copy silently stays on an old base (the eu site ran a 3.9.2 version string over
pre-3.8.13 `com_users` code). Take vanilla for the version you target, then apply only
the genuine delta.
## 8. Definition of done
A baseline branch is done when:
- `build-baseline.sh` runs unmodified and produces `out/`;
- all five checks in §4 pass, and the numbers are recorded in the commit message;
- every layer's provenance is traceable (which file came from upstream, from the
developer source, or vetted from live);
- no secret value appears anywhere in the diff or the message.

173
README.md
View File

@ -1,81 +1,52 @@
# Cadline web baselines — constituents + generator
# www.archline.hu — clean baseline (constituents + generator)
This repo produces the **clean code baselines** of the Cadline web sites hosted on
`tanis.cadline.hu` — malware-free, faithful reproductions of what each site's source
*should* be, assembled from clean sources rather than copied from the live server.
This repo produces the **clean code baseline** of the www.archline.hu docroot
(Cadline, Joomla 3.8.11, host `tanis.cadline.hu`) — the post-compromise, malware-free,
faithful reproduction of the live server's source files.
A baseline has **two jobs**:
1. **Known-good reference.** The HIDS baseline-diff compares the live docroot against it
and classifies every file (`baseline-match / data / malware / residual`).
2. **Deployment source of truth.** The baseline is what gets deployed to the server, so
that code reaches production through git instead of being edited directly on the live
host. Because the live tree is regenerated from the baseline, cleanup becomes a
by-product of deployment: anything not in the source disappears.
The repo stores the baseline **constituents plus a generator** — never the deployed tree.
The baseline is the **input** to the HIDS baseline-diff verifier: a per-vhost,
known-good reference tree the verifier compares the live docroot against
(`baseline-match / data / malware / residual`). This repo only *produces* that tree;
the verification runs on the HIDS side.
---
## Sites and branches
## Building the baseline (read this first)
There is **no separate repo per site**. Sites (and CMS versions) live on **branches**:
| Branch | Site | CMS core | Own code source |
|---|---|---|---|
| `main` | www.archline.hu | Joomla 3.8.11 | reconstructed here (no usable developer source) |
| `site/archlinexp.eu` | www.archlinexp.eu | Joomla 3.9.2 | `cadline/websource``www.archlinexp.eu/` |
`build-baseline.sh` is **site-agnostic** — it walks the constituent directories and has
no site-specific logic. A new site is a new branch with different *content*, not a new
script and not a new repo. Site branches are parallel and long-lived; they do not merge
into `main`. Only repo-wide files (this README, `AGENTS.md`, the generator, `lib/`) live
on `main` for every branch to inherit.
Automated agents: read [`AGENTS.md`](AGENTS.md) first — it carries the rules
(verification, repo boundary, layer semantics) in machine-facing form.
---
## Building a baseline (read this first)
The repo does **not** contain the deployed docroot — it contains the baseline
*constituents* plus a generator script. Run the script to produce the deployed tree:
```sh
# 1. Clone, and check out the branch of the site you want:
# 1. Clone WITH submodules (common_cadline_libraries + maintenance are submodules):
git clone --recurse-submodules ssh://git@git.cadline.hu:22222/cadline_web/www_archline_hu.git
cd www_archline_hu
git checkout site/archlinexp.eu # or stay on main for www.archline.hu
# (if you cloned without --recurse-submodules and the branch uses submodules:)
# (if you already cloned without --recurse-submodules:)
git submodule update --init
# 2. Generate:
./build-baseline.sh # → ./out/
# 2. Generate the baseline:
./build-baseline.sh # → ./out/
# 3. Use ./out/ as that site's known-good reference / deploy source.
# 3. Use ./out/ as the per-vhost vanilla_ref (the known-good reference tree).
```
`out/` is the deployed **code** docroot. It is git-ignored and fully regenerated on every
run (the script `rm -rf out/` first, so it is idempotent).
`out/` is the deployed **code** docroot (~23.5k files). It is git-ignored and fully
regenerated on every run (the script is idempotent — it `rm -rf out/` first). Point the
verifier's baseline-diff at `out/`, or copy it to wherever the verifier expects the ref.
**Prerequisites:** `bash`, `rsync`, `git`, `find`, `sed`. No PHP, no build toolchain, no
network at build time. `lib/jmap.py` (python3) is an *authoring* aid used when preparing a
package's pristine commit — **`build-baseline.sh` never invokes it**.
**Prerequisites:** `bash`, `rsync`, `git` (for submodules), `find`, `sed`. No PHP, no
build toolchain, no network at build time (submodules are already cloned).
`lib/jmap.py` (python3) is a *maintenance* tool used only when authoring a package's
pristine commit — **it is not invoked by `build-baseline.sh`**.
**What `out/` contains / excludes:**
- **Contains:** the CMS core + every installed extension + the Cadline-own code, as
deployed files.
- **Excludes:** malware and known planted paths (`malware-iocs.paths`), and runtime
**data** (`cache/`, `tmp/`, `logs/`, `images/`, `public/`, media). The result is code
only — which is also why a deploy must never wipe the data directories.
### Verify before you trust it
The build output is **not** trusted until checked. This is not ceremony: the first
archline baseline candidate contained 34 malware files, and only the check caught them;
on the eu site the check caught a file-write webshell and a leftover Akeeba restoration
file that carried a password — **neither of which YARA flagged**. See `AGENTS.md` §4 for
the full checklist (YARA, IOC paths, disguise sweep, the structural core-namespace rule,
core version).
- **Contains:** Joomla 3.8.11 core + every installed extension (110 components, ~98
modules, 164 plugins, 8 templates) + the Cadline-own code — all as deployed files.
- **Excludes:** malware/IOCs (see [`malware-iocs.md`](malware-iocs.md)) and runtime
**data** (`cache/`, `tmp/`, `logs/`, `images/`, `public/`, media data). The result is
code only.
- Byte-matches the live docroot for all legit code; it is intentionally **clean** on the
4 files the attacker infected (3 trojanized core files + `shaper_helix3/index.php`),
so the verifier flags those on the live server. Verified: non-malware code residual = 0.
---
@ -83,77 +54,49 @@ core version).
| Path | What | How `build-baseline.sh` uses it |
|---|---|---|
| `core/` | CMS official package (deployed form, installer removed) | rsync → `out/`, minus demo assets + data dirs |
| `packages/<slug>/` | extensions with an obtainable upstream, deployed-layout. Modified ones are authored as two commits (pristine upstream → our delta) so `git log`/`git diff` shows exactly how we differ. | rsync → `out/` |
| `deployed/<slug>/` | extensions with **no** obtainable upstream: vetted live files, deployed layout. | rsync → `out/` |
| `cadline/<slug>/` | Cadline own-code. On `main` this includes git submodules of the developer repos (cadcommonlib / maintenance). | rsync → `out/` (`.git` excluded) |
| `overrides/` | the site's modifications to core files, on the current core's base. Rsynced **last**, so it wins. | rsync → `out/` |
| `malware-iocs.paths` | machine-readable exclusion list (droppers, leftovers) | build step 6 |
| `lib/jmap.py` | Joomla manifest→deployed-path mapper (authoring aid only) | not used at build time |
| `core/` | Joomla 3.8.11 official package (deployed form) | rsync → `out/`, minus demo assets + data dirs |
| `packages/<slug>/` | 5 upstream-obtainable extensions, deployed-layout, reconciled to live bytes. Modified ones are two commits (pristine upstream → live delta) so `git log`/`git diff` shows exactly how we differ from upstream. | rsync → `out/` |
| `deployed/<slug>/` | ~55 no-source extensions: vetted live files (deployed layout). `_shared/` holds cross-extension language/vendor/manifests. | rsync → `out/` |
| `cadline/<slug>/` | Cadline own-code. `cadline/backend/common_cadline_libraries` and `…/maintenance` are **git submodules** of the developer repos (cadcommonlib / maintenance). | rsync → `out/` (`.git` excluded) |
| `overrides/` | Cadline core modifications (live versions overlaid on the package core) + a few package-missing core files. | rsync → `out/` (last, so it wins) |
| `lib/jmap.py` | Generic Joomla manifest→deployed-path mapper (authoring aid only). | not used at build time |
Details: [`RUNBOOK.md`](RUNBOOK.md) (recipe + module inventory),
[`PROVENANCE.md`](PROVENANCE.md) (per-extension origins),
[`malware-iocs.md`](malware-iocs.md) (the excluded IOC set, `main`).
[`malware-iocs.md`](malware-iocs.md) (excluded IOC set).
---
## Why customized core files never come from live
## Updating the baseline
A CMS updater skips files the site has customized. The version string moves forward; the
customized files silently stay on the old base. The eu site demonstrated this: it
reported Joomla 3.9.2 while its `com_users` was still pre-3.8.13 code — 31 stale files.
So: take **vanilla for the version you target**, then apply only the genuine delta into
`overrides/`. Never lift the customized file from live — that would preserve the stale
(and possibly vulnerable) base forever.
---
## This branch: www.archline.hu (`main`)
Joomla 3.8.11, host `tanis.cadline.hu`. `out/` ≈ 23.5k files. It byte-matches the live
docroot for all legit code and is intentionally **clean** on the 4 files the attacker
infected (3 trojanized core files + `shaper_helix3/index.php`), so the verifier flags
those on the live server. Verified: non-malware code residual = 0.
The own-code here is **reconstructed in this repo**, because the developer source
(`cadline/websource`) does not contain this site — its `sub.archline.hu` directory is an
older snapshot missing ~630 files and the third-party module layer entirely.
### Updating
- **Developer-controlled code** (`common_cadline_libraries`, `maintenance`): the developer
pushes to the cadcommonlib / maintenance repos, then:
- **Developer-controlled code** (`common_cadline_libraries`, `maintenance`): the
developer pushes to the cadcommonlib / maintenance repos, then:
```sh
git submodule update --remote # pull the developer's latest
./build-baseline.sh # regenerate out/
git add -A && git commit # record the new submodule pointers
```
- **Everything else** (EOL core, 3rd-party extensions): effectively frozen. If a legit
change lands, re-sync the affected `deployed/<slug>/` or `overrides/` and commit.
- **Everything else** (Joomla core EOL, 3rd-party extensions): effectively frozen; if a
legit change ever lands, re-sync the affected `deployed/<slug>/` or `overrides/` from
the live docroot and commit.
**Known divergence (heads-up for the verifier):** `common_cadline_libraries` and
`maintenance` take the *authoritative* submodule HEAD content, which differs from the
current live docroot (mixed CRLF/LF + a content drift on `crm_hardlock.class.php` /
`POfile.php`) because live was not last deployed from those HEADs. The verifier flags
this until live is re-deployed or the drift is reconciled.
## This branch: www.archlinexp.eu (`site/archlinexp.eu`)
Joomla 3.9.2. `out/` ≈ 12.3k files. Built from clean sources end to end: vanilla 3.9.2
core + the developer source's own code + a vetted module layer, with only 5 genuine core
modifications in `overrides/`. The developer source for this site is **complete and
clean** (its `com_users` is already on the 3.9.2 base), which is why this site — not
archline.hu — was the first to get a fully source-built baseline.
`maintenance` currently take the *authoritative* submodule HEAD content, which differs
from the current live docroot (mixed CRLF/LF + a content drift on
`crm_hardlock.class.php` / `POfile.php`) because live was not last deployed from those
HEADs. The verifier will flag this until live is re-deployed from the submodules or the
drift is reconciled. Line-ending normalization, if wanted, is a verifier-side choice.
---
## Authority
- The **upstream vendor package** is authoritative for the CMS core.
- The **developer source repo** is authoritative for the code it owns.
- The **live docroot** (read-only mirror) is authoritative only for reproduction fidelity
and for extensions that have no obtainable upstream — and even then the files are
vetted, never trusted.
- The earlier single-commit "monolith" baseline is an unvalidated helper only (it dropped
extension manifests and clean core files and kept installer junk) — not a target.
The live docroot (RO mirror) is the source of truth for reproduction; the developer git
repos are authoritative for the code they own. The earlier single-commit "monolith"
baseline is an unvalidated helper only (it dropped extension manifests and clean core
files and kept installer junk) — it is not a target.
## References
- The archline.hu 2026 security audit and incident analysis (operator-held).
- The excluded malware set is documented in [`malware-iocs.md`](malware-iocs.md).

View File

@ -73,27 +73,11 @@ fi
# the live divergence until live is re-deployed or the drift is reconciled.
# Line-ending normalization is intentionally left to the verifier, not applied here.
# 6) Safety net — CONTENT-based malware exclusion. The constituent sources above
# are vetted clean, but this catches a planted file regardless of its extension
# disguise. The 2026 incident planted one webshell under ~20 fake extensions
# (.inc.json / .phar.json / .php[3-5].json / .php.json.json) plus plain-.json
# defacements — an extension allowlist (the old '*.php.json' filter) missed ALL
# of them. The robust signal is CONTENT, not extension.
log "exclude: content-based malware safety net"
# (a) Any .json under templates/ carrying a PHP open tag is NOT a legit Helix3
# layout preset (those are pure JSON) — it is a disguised dropper. This closes
# the .json-disguise gap deterministically.
if [ -d "$OUT/templates" ]; then
find "$OUT/templates" -type f -name '*.json' 2>/dev/null | while IFS= read -r j; do
if grep -Ilq -m1 -E '<\?php|<\?=' "$j" 2>/dev/null; then
log " drop (php-in-json): ${j#"$OUT"/}"; rm -f "$j"
fi
done
fi
# (b) Legacy extension patterns (belt-and-suspenders; harmless if already gone).
# 6) Safety net — malware IOC + scan artifacts must never appear in the baseline
# (the sources above already exclude them; this is defensive, documented in
# malware-iocs.md / malware-iocs.paths).
log "exclude: malware IOC + scan artifacts"
find "$OUT" \( -name '*.php.json' -o -name '*.phtml.json' -o -name 'h3x_*' -o -name '_h3x_*' \) -delete 2>/dev/null || true
# (c) Explicit IOC path list (docroot-relative) — the plain-.json defacements,
# probe artifacts and non-.json droppers that a content grep cannot key on.
if [ -f "$ROOT/malware-iocs.paths" ]; then
while IFS= read -r ioc; do
[ -z "$ioc" ] && continue
@ -102,14 +86,4 @@ if [ -f "$ROOT/malware-iocs.paths" ]; then
done < "$ROOT/malware-iocs.paths"
fi
# (d) .htaccess-based PHP-enable persistence — apache-config droppers the
# content/extension filters above miss (no <?php tag, not *.php.json).
# Mirrors the malware_htaccess_php_enable YARA rule (illusion/hids#183).
log "exclude: .htaccess-based php-enable persistence"
find "$OUT" -type f \( -name '.htaccess' -o -name '.htaccess.*' \) 2>/dev/null | while IFS= read -r h; do
if grep -IlqE 'Add(Type|Handler)[[:space:]]+application/x-httpd-php[0-9]?[[:space:]]+\.(json|jpe?g|png|gif|txt|ico|css|html?|xml|svg|bak|log)|php_flag[[:space:]]+engine[[:space:]]+on' "$h" 2>/dev/null; then
log " drop (htaccess-php-enable): ${h#"$OUT"/}"; rm -f "$h"
fi
done
log "baseline built at: $OUT ($(find "$OUT" -type f | wc -l) files)"

@ -1 +1 @@
Subproject commit 6bd9cb2e1c0844e57fa9cad83ba2baa6e056418d
Subproject commit 423fec9b929b381339d71623fc621a998a6e3e0f

@ -1 +1 @@
Subproject commit 7e8036235b05d493363791b46bb2ebdc33bb5f2e
Subproject commit 11f1a543340bb7a2f03c3647dca03b7bd79783d0

View File

@ -0,0 +1,544 @@
<?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;
******************************************************************************/
include ("config.php");
include ("version.php");
include ("functions.php");
include ("mtips.php");
if (!class_exists('crmHelper')) require_once("class/crmHelper.class.php");
error_log(print_r($_GET,TRUE),3,"../tmp/error_tips.log");
$version = New Version();
$mtips = New Mtips();
$user_lang_db = $user_lang = $origlang = (isset($_GET['lang']) ? trim($_GET['lang']) : NULL);
$user_version = (isset($_GET['version']) ? trim($_GET['version']) : NULL);
$user_ssID = (isset($_GET['session']) ? trim($_GET['session']) : NULL);
$user_IP = $_SERVER['REMOTE_ADDR'];
$osdata = '';
$time=time();
$namirialRangeMin=940001;
$namirialRangeMax=949999;
$BIMLadderRangeMin=920001;
$BIMLadderRangeMax=929999;
if( strstr($_SERVER['REQUEST_URI'],"ize") ) print $mtips->tips_src.$data['current_lang'].'/';
if(!$user_lang) { print('No language id given, try to add /en to the uri'); }
if(!is_numeric($user_version)) { print('Invalid version id sent: '.$user_version); }
if(!in_array($user_lang,$mtips->existing_lang)) { $user_lang = 'eng'; }
$user_lang = $mtips->lang_check($user_lang);
$settings = $mtips->read_settings($user_lang);
//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 ($_SERVER['REMOTE_ADDR']=='188.6.239.155') {print "user_lang_db: ".$user_lang_db." user_version: ".$user_version." user_ssID: ".$user_ssID; die(); }
if($user_lang_db && /*$user_version && */ $user_ssID!='')
{
$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
//error_log("decoded = ".print_r($decoded,FALSE)." pwd: ".$pwd." build: ".$build." user_version: ".$user_version." idokod: ".$idokod."\n",3,"../tmp/error.log");
if( $numdata >= 11 )
{
list($empty, $pwd, $compID, $build, $ctrID, $idokod, $osdata, $usGCMan, $usGCType, $usGCDriverVer, $npID, $partnerID, $name, $email, $company, $phone, $newsletter) = split($separator, $decoded);
}
elseif( $numdata >= 6 )
{
list($empty, $pwd, $compID, $build, $ctrID, $idokod, $osdata, $usGCMan, $usGCType, $usGCDriverVer, $npID, $partnerID) = split($separator, $decoded);
}
else
{
list($empty, $pwd, $compID, $build, $ctrID, $idokod) = split($separator, $decoded);
}
//if ($_SERVER['REMOTE_ADDR']=='46.139.14.111') { print "decoded = ".print_r( explode("_",$decoded),FALSE)."\n\n<br>user_version: ".$user_version." , idokod: ".$idokod." npID: ".$npID." partnerID: ".$partnerID." pwd: ".$pwd; /*die();*/ }
<<<<<<< HEAD
if(isset($npID)){
$compid = crmHelper::AddOrUpdateComputer($npID);
}
=======
>>>>>>> f2ebce6b191a229c054099f929f7145b78d46007
/*******************************************************************************
*NAMIRIAL-os automata kulcskiadás és program létrehozás
******************************************************************************/
if (isset($npID) && $npID>'' && isset($partnerID) && $partnerID=='2nt' && isset($idokod) && $idokod>'' && isset($pwd) && $pwd>'')
<<<<<<< HEAD
{
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`nonprofit` WHERE computer_id='".$compid."' AND partnerID = '2nt' LIMIT 1;");
=======
{
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`computers` WHERE `computer_id`='".$npID."' LIMIT 1;");
$res4=MySqlHelper::getInstance()->fetchAssoc();
if(empty($res4)){
$comp=array(
'computer_id'=>$npID,
'last_mod'=>date('Y-m-d',time()));
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`computers`",$comp);
}
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`computers` WHERE `computer_id`='".$npID."' LIMIT 1;");
$compid=MySqlHelper::getInstance()->fetchAssoc();
$programVersion=substr($pwd, 7, 2);
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`nonprofit` WHERE computer_id='".$compid[0]['id']."' AND partnerID = '2nt' AND verID =".$programVersion." LIMIT 1;");
>>>>>>> f2ebce6b191a229c054099f929f7145b78d46007
$res=MySqlHelper::getInstance()->fetchAssoc();
//ba nincs ehhez a gephez meg non-profit program regisztralva
if (empty($res))
{
$hlNum=tryToAlloc($namirialRangeMin,$namirialRangeMax);
$arrIdokod=explode("-", $idokod);
$isid=$arrIdokod[1];
$type=substr($pwd, 6, 1);
$verid=substr($pwd, 7, 2);
$ver=$version->getVersion(array('verPassword8and9'=>$verid));
$interval=90;
$pass=generatePassword($hlNum,0,$type,$ver['verCode']);
$aktKod=generateTimeCode($pass,$isid,$interval);
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`u_emails` WHERE `email`='{$email}' LIMIT 1;");
$exist=MySqlHelper::getInstance()->fetchAssoc();
if (!$exist) //ba elsodleges szempont, hogy a megadott email cimmel van-e crm bejegyzes
{
//ba felvesszuk a user-t
$userdata=array(
'strName'=>$name,
'strEMail'=>$email,
'strCompany'=>$company,
'strTel'=>$phone,
'old_db'=>'clusers_eng',
'nCtrID'=>39,
'dateInsert'=>$time);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`users`",$userdata);
MySqlHelper::getInstance()->query("SELECT nUserID as nUserID FROM `".CRMADATBAZIS."`.`users` WHERE strEMail='{$email}' AND strName='{$name}' limit 1");
$userQuery=MySqlHelper::getInstance()->fetchAssoc();
$userID = $userQuery[0]['nUserID'];
//ba felvesszuk az email cimet a userhez
$emaildata=array(
'email'=>$email,
'nUserID'=>$userID,
'newsletter'=>$newsletter
);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`u_emails`",$emaildata);
}
else
{
//ba a meglevo userhez fogjuk kotni a programot
$userID=$exist[0]['nUserID'];
}
//ba regisztraljuk hozza a non-profit programot
$nonprofit=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);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`nonprofit`",$nonprofit);
//Namirial non-profit kód aktiválás beszúrása crm -> u_history táblába
$esemeny=array(
'nUserID'=>$userID,
'nTopicID'=>366,
'dateEvent'=>date('Y-m-d H:i:s',$time),
'strPlace'=>'',
'strInfo'=>'Namirial nonprofit kulcs aktiválás',
'nManagerID'=>36,
'insertDate'=>date('Y-m-d H:i:s',$time));
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`u_history`",$esemeny);
$hardlock=array(
'hlNum'=>$hlNum,
'hlCtrID'=>39,
'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');
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`hardlock`",$hardlock);
$program=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 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'=>8, // Non-profit
'prHlNum'=>$hlNum, // 99xxxx
'prManID'=>36, // web
'prStat'=>0,
'prHiType'=>1, // 1 Rendelés | 2 Típus Váltás | 3 Frissítés | 4 Auto Friss.
);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`h_programs`",$program);
$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
$hardlockID = $res[0]['hlID'];
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE prHlNum='{$hardlockID}' limit 1");
$programQuery=MySqlHelper::getInstance()->fetchAssoc();
$pwd = $programQuery[0]['prPass'];
}
}
/*******************************************************************************
*BIMLadder-es automata kulcskiadás és program létrehozás
******************************************************************************/
else if (isset($npID) && $npID>'' && isset($partnerID) && $partnerID=='kbl' && isset($idokod) && $idokod>'' && isset($pwd) && $pwd>'')
{
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`nonprofit` WHERE computer_id='".$compid."' AND partnerID = 'kbl' LIMIT 1;");
$res=MySqlHelper::getInstance()->fetchAssoc();
//ba nincs ehhez a gephez meg non-profit program regisztralva
if (empty($res))
{
$hlNum=tryToAlloc($BIMLadderRangeMin,$BIMLadderRangeMax);
$arrIdokod=explode("-", $idokod);
$isid=$arrIdokod[1];
$type=substr($pwd, 6, 1);
$verid=substr($pwd, 7, 2);
$ver=$version->getVersion(array('verPassword8and9'=>$verid));
$interval=30; //ba !!! nem 90!!!
$pass=generatePassword($hlNum,0,$type,$ver['verCode']);
$aktKod=generateTimeCode($pass,$isid,$interval);
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`u_emails` WHERE `email`='{$email}' LIMIT 1;");
$exist=MySqlHelper::getInstance()->fetchAssoc();
if (!$exist) //ba elsodleges szempont, hogy a megadott email cimmel van-e crm bejegyzes
{
//ba felvesszuk a user-t
$userdata=array(
'strName'=>$name,
'strEMail'=>$email,
'strCompany'=>$company,
'strTel'=>$phone,
'old_db'=>'clusers_eng',
'nCtrID'=>82,
'dateInsert'=>$time);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`users`",$userdata);
MySqlHelper::getInstance()->query("SELECT nUserID as nUserID FROM `".CRMADATBAZIS."`.`users` WHERE strEMail='{$email}' AND strName='{$name}' limit 1");
$userQuery=MySqlHelper::getInstance()->fetchAssoc();
$userID = $userQuery[0]['nUserID'];
//ba felvesszuk az email cimet a userhez
$emaildata=array(
'email'=>$email,
'nUserID'=>$userID,
'newsletter'=>$newsletter
);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`u_emails`",$emaildata);
}
else
{
//ba a meglevo userhez fogjuk kotni a programot
$userID=$exist[0]['nUserID'];
}
//ba regisztraljuk hozza a non-profit programot
$nonprofit=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('+30 day', $time)), //ba 30 nap!!!!
'activation_datetime'=>date('Y-m-d H:i:s',$time),
'old_db'=>'clusers_eng',
'partnerID'=>$partnerID,
'enabled'=>'Y',
'computer_id'=>$compid);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`nonprofit`",$nonprofit);
//BIMLadder non-profit kód aktiválás beszúrása crm -> u_history táblába
$esemeny=array(
'nUserID'=>$userID,
'nTopicID'=>368,
'dateEvent'=>date('Y-m-d H:i:s',$time),
'strPlace'=>'',
'strInfo'=>'BIMLadder nonprofit kulcs aktiválás',
'nManagerID'=>36,
'insertDate'=>date('Y-m-d H:i:s',$time));
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`u_history`",$esemeny);
$hardlock=array(
'hlNum'=>$hlNum,
'hlCtrID'=>82,
'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');
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`hardlock`",$hardlock);
$program=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 nap helyett 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'=>9,
'prHlNum'=>$hlNum, // 99xxxx
'prManID'=>36, // web
'prStat'=>0,
'prHiType'=>1, // 1 Rendelés | 2 Típus Váltás | 3 Frissítés | 4 Auto Friss.
);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`h_programs`",$program);
$pwd = $pass; //ba 2018.11.26. mostantol az uj jelszava a usernek a most generalt, 92-es lesz, nem pedig a 91-es!
}
else
{
//ba ehhez a gephez mar volt non-profit regisztracio, keressuk ki a sorozatszamot neki
$hardlockID = $res[0]['hlID'];
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE prHlNum='{$hardlockID}' limit 1");
$programQuery=MySqlHelper::getInstance()->fetchAssoc();
$pwd = $programQuery[0]['prPass'];
}
}
//insert stats to the userstats table
$stats = array(
'usLang' => $user_lang_db,
'usDate' => time(),
'usPwd' => $pwd,
'usVer'=>substr($pwd,7,2),
'usCompID' => $compID,
'usCtrID' => $ctrID,
'usBuild' => $build,
'usCtrName' => $ctrname,
'usIP' => $user_IP,
'usOSData' => $osdata,
// 'usISID' => $isid,
);
$liveKey = $version->isLiveKey($pwd) == 'true'; // Live kulcs 2019
$softwareKey = $version->isSoftwareKey($pwd) == 'true'; // Software kulcs 2019
if($softwareKey)
$stats['usISID'] = substr($idokod, 5, 4);
if (trim($usGCMan)>'' && trim($usGCType)>'' && trim($usGCDriverVer)>'')
{
$arrGCData=array(
'usGCMan'=>trim($usGCMan), // graphic card manufacture
'usGCType'=>trim($usGCType), // graphic card type
'usGCDriverVer'=>trim($usGCDriverVer), // graphic card driver version
);
$stats['usGCMan']=$arrGCData['usGCMan'];
$stats['usGCType']=$arrGCData['usGCType'];
$stats['usGCDriverVer']=$arrGCData['usGCDriverVer'];
}
if($softwareKey)
{
if($liveKey || in_array(substr($pwd,0,2), array('99','98','95')) ) // Azok a programok, amik regisztrálódnak a CRM-ben 2019
{
$msh->query("SELECT hlCtrID FROM ".CRMADATBAZIS.".hardlock WHERE hlNum='".substr($pwd,0,6)."'");
$res=$msh->fetchAssoc();
$hlnum=$res[0];
if(isset($hlnum['hlCtrID'])) $stats['usHlCtrID'] = $hlnum['hlCtrID'];
}
}
else
{
$stats['usHlCtrID'] = substr($pwd,0,2);
}
$msh2->insert('userstats2013',$stats);
$usstatid=$msh2->getInsertedId();
}
else
{
//if ($_SERVER['REMOTE_ADDR']=='188.6.239.155') {print "haha"; die();}
$rec=array(
'hiba'=>"Valami hianyzik: {$pwd}\nlang: {$user_lang_db}\nverzio: {$user_version}\nssID: {$user_ssID}",
'datum'=>date('Y-m-d H:i:s',time())
);
$msh2->insert('a_hibak',$rec);
}
//if ($_SERVER['REMOTE_ADDR']=='188.6.239.155') {var_dump($pwd); die();}
//loading the xml tips if necessary
if(!$settings)
{
print('Unable to load the corresponding settings.xml file!');
$rec=array(
'hiba'=>"beallitas hianyzik: {$pwd}\nlang: {$user_lang_db}\nverzio: {$user_version}\nssID: {$user_ssID}",
'datum'=>date('Y-m-d H:i:s',time())
);
// if($_SERVER['REMOTE_ADDR'] == "188.36.217.1") var_dump($rec);
$msh2->insert('a_hibak',$rec);
}
else
{
if(substr($pwd,7,2)>29 && substr($pwd,0,2)!='96')
{
$isid=($softwareKey ? substr($idokod,5,4) : substr($pwd,0,2).substr($pwd,7,2));
$kulcsszam = substr($pwd,0,6);
$msh->query("SELECT hlStat,hlUser FROM `".CRMADATBAZIS."`.`hardlock` WHERE hlNum='{$kulcsszam}'");
$res=$msh->fetchAssoc();
$kulcs=$res[0];
$aktivalokod = $version->ujaktivalasikod2($pwd,$isid,$idokod);
//if ($_SERVER['REMOTE_ADDR']=='188.6.239.155') {var_dump($aktivalokod); die();}
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
{
$msh->query("SELECT COUNT(*) AS `darab` FROM `".CRMADATBAZIS."`.`h_aktivalas_infok` WHERE kulcs='".$kulcsszam."';");
$tmp=$msh->fetchAssoc();
$darab=(int)$tmp[0]['darab'];
$msh->query("SELECT COUNT(*) AS `darab` FROM `".CRMADATBAZIS."`.`u_history` WHERE `nUserID`=".(int)$kulcs['hlUser']." AND nTopicID IN (314,315);");
$tmp=$msh->fetchAssoc();
$esem=(int)$tmp[0]['darab'];
$msh->query("SELECT * FROM `".CRMADATBAZIS."`.`users` WHERE nUserID='".(int)$kulcs['hlUser']."';");
$usr=$msh->fetchAssoc();
$usr=$usr[0];
if (!empty($usr) && ($darab==0 || $esem==0))
{
$msh->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').': '.$kulcsszam,
'nManagerID'=>36,
'insertDate'=>date('Y-m-d H:i:s'),
));
}
}
$virtualization = ($kulcs['hlStat']=='2' ? "false" : "true"); // letiltott kulcs visszajelzése a programnak
$valasz = ($aktivalokod!="") ? $aktivalokod : "(( nem kapott valaszt ))";
$version->_hibajelento("tips",substr($pwd,0,6),"programinditas - pw: {$pwd}, build: {$build}, isid: {$isid}, időkód: {$idokod}, valasz: ".$valasz,(isset($arrGCData)?$arrGCData:array()),(isset($usstatid)?$usstatid:NULL));
if(is_numeric($usstatid)) $msh2->update("userstats2013",array('valasz'=>$valasz),array('usID'=>$usstatid));
}
//logFilter
$logfilter=0;
if ($pwd>0)
{
$msh->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE `prPass`='".$pwd."' LIMIT 1;");
$res=$msh->fetchAssoc();
$logfilter=$res[0]['prLogFilter'];
}
$verid=substr($pwd, 7, 2);
if($verid >= 36){
$hlnum = substr($pwd,0,6);
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`hardlock_computers` WHERE hlNum='".$hlnum."' AND computer_id='".$compid."' LIMIT 1;");
$res=MySqlHelper::getInstance()->fetchAssoc();
if(empty($res)){
$comp=array(
'hlNum'=>$hlnum,
'computer_id'=>$compid);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`hardlock_computers`",$comp);
}
}
// if ($_SERVER['REMOTE_ADDR']!='46.139.109.235') return; //ba hibás válaszok ideiglenes kikötése
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="'.$settings->lang.'" version="'.$settings->version.'">
<path>'.str_replace('..','',$mtips->tips_src).$settings->lang.'/'.'</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>
<loginEnabled>'.($kulcsszam=='360006' ? 'true' : 'false').'</loginEnabled>
</Tips>';
}
?>

View File

@ -0,0 +1,544 @@
<?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;
******************************************************************************/
include ("config.php");
include ("version.php");
include ("functions.php");
include ("mtips.php");
if (!class_exists('crmHelper')) require_once("class/crmHelper.class.php");
error_log(print_r($_GET,TRUE),3,"../tmp/error_tips.log");
$version = New Version();
$mtips = New Mtips();
$user_lang_db = $user_lang = $origlang = (isset($_GET['lang']) ? trim($_GET['lang']) : NULL);
$user_version = (isset($_GET['version']) ? trim($_GET['version']) : NULL);
$user_ssID = (isset($_GET['session']) ? trim($_GET['session']) : NULL);
$user_IP = $_SERVER['REMOTE_ADDR'];
$osdata = '';
$time=time();
$namirialRangeMin=940001;
$namirialRangeMax=949999;
$BIMLadderRangeMin=920001;
$BIMLadderRangeMax=929999;
if( strstr($_SERVER['REQUEST_URI'],"ize") ) print $mtips->tips_src.$data['current_lang'].'/';
if(!$user_lang) { print('No language id given, try to add /en to the uri'); }
if(!is_numeric($user_version)) { print('Invalid version id sent: '.$user_version); }
if(!in_array($user_lang,$mtips->existing_lang)) { $user_lang = 'eng'; }
$user_lang = $mtips->lang_check($user_lang);
$settings = $mtips->read_settings($user_lang);
//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 ($_SERVER['REMOTE_ADDR']=='188.6.239.155') {print "user_lang_db: ".$user_lang_db." user_version: ".$user_version." user_ssID: ".$user_ssID; die(); }
if($user_lang_db && /*$user_version && */ $user_ssID!='')
{
$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
//error_log("decoded = ".print_r($decoded,FALSE)." pwd: ".$pwd." build: ".$build." user_version: ".$user_version." idokod: ".$idokod."\n",3,"../tmp/error.log");
if( $numdata >= 11 )
{
list($empty, $pwd, $compID, $build, $ctrID, $idokod, $osdata, $usGCMan, $usGCType, $usGCDriverVer, $npID, $partnerID, $name, $email, $company, $phone, $newsletter) = split($separator, $decoded);
}
elseif( $numdata >= 6 )
{
list($empty, $pwd, $compID, $build, $ctrID, $idokod, $osdata, $usGCMan, $usGCType, $usGCDriverVer, $npID, $partnerID) = split($separator, $decoded);
}
else
{
list($empty, $pwd, $compID, $build, $ctrID, $idokod) = split($separator, $decoded);
}
//if ($_SERVER['REMOTE_ADDR']=='46.139.14.111') { print "decoded = ".print_r( explode("_",$decoded),FALSE)."\n\n<br>user_version: ".$user_version." , idokod: ".$idokod." npID: ".$npID." partnerID: ".$partnerID." pwd: ".$pwd; /*die();*/ }
<<<<<<< HEAD
if(isset($npID)){
$compid = crmHelper::AddOrUpdateComputer($npID);
}
=======
>>>>>>> f2ebce6b191a229c054099f929f7145b78d46007
/*******************************************************************************
*NAMIRIAL-os automata kulcskiadás és program létrehozás
******************************************************************************/
if (isset($npID) && $npID>'' && isset($partnerID) && $partnerID=='2nt' && isset($idokod) && $idokod>'' && isset($pwd) && $pwd>'')
<<<<<<< HEAD
{
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`nonprofit` WHERE computer_id='".$compid."' AND partnerID = '2nt' LIMIT 1;");
=======
{
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`computers` WHERE `computer_id`='".$npID."' LIMIT 1;");
$res4=MySqlHelper::getInstance()->fetchAssoc();
if(empty($res4)){
$comp=array(
'computer_id'=>$npID,
'last_mod'=>date('Y-m-d',time()));
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`computers`",$comp);
}
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`computers` WHERE `computer_id`='".$npID."' LIMIT 1;");
$compid=MySqlHelper::getInstance()->fetchAssoc();
$programVersion=substr($pwd, 7, 2);
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`nonprofit` WHERE computer_id='".$compid[0]['id']."' AND partnerID = '2nt' AND verID =".$programVersion." LIMIT 1;");
>>>>>>> f2ebce6b191a229c054099f929f7145b78d46007
$res=MySqlHelper::getInstance()->fetchAssoc();
//ba nincs ehhez a gephez meg non-profit program regisztralva
if (empty($res))
{
$hlNum=tryToAlloc($namirialRangeMin,$namirialRangeMax);
$arrIdokod=explode("-", $idokod);
$isid=$arrIdokod[1];
$type=substr($pwd, 6, 1);
$verid=substr($pwd, 7, 2);
$ver=$version->getVersion(array('verPassword8and9'=>$verid));
$interval=90;
$pass=generatePassword($hlNum,0,$type,$ver['verCode']);
$aktKod=generateTimeCode($pass,$isid,$interval);
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`u_emails` WHERE `email`='{$email}' LIMIT 1;");
$exist=MySqlHelper::getInstance()->fetchAssoc();
if (!$exist) //ba elsodleges szempont, hogy a megadott email cimmel van-e crm bejegyzes
{
//ba felvesszuk a user-t
$userdata=array(
'strName'=>$name,
'strEMail'=>$email,
'strCompany'=>$company,
'strTel'=>$phone,
'old_db'=>'clusers_eng',
'nCtrID'=>39,
'dateInsert'=>$time);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`users`",$userdata);
MySqlHelper::getInstance()->query("SELECT nUserID as nUserID FROM `".CRMADATBAZIS."`.`users` WHERE strEMail='{$email}' AND strName='{$name}' limit 1");
$userQuery=MySqlHelper::getInstance()->fetchAssoc();
$userID = $userQuery[0]['nUserID'];
//ba felvesszuk az email cimet a userhez
$emaildata=array(
'email'=>$email,
'nUserID'=>$userID,
'newsletter'=>$newsletter
);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`u_emails`",$emaildata);
}
else
{
//ba a meglevo userhez fogjuk kotni a programot
$userID=$exist[0]['nUserID'];
}
//ba regisztraljuk hozza a non-profit programot
$nonprofit=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);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`nonprofit`",$nonprofit);
//Namirial non-profit kód aktiválás beszúrása crm -> u_history táblába
$esemeny=array(
'nUserID'=>$userID,
'nTopicID'=>366,
'dateEvent'=>date('Y-m-d H:i:s',$time),
'strPlace'=>'',
'strInfo'=>'Namirial nonprofit kulcs aktiválás',
'nManagerID'=>36,
'insertDate'=>date('Y-m-d H:i:s',$time));
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`u_history`",$esemeny);
$hardlock=array(
'hlNum'=>$hlNum,
'hlCtrID'=>39,
'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');
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`hardlock`",$hardlock);
$program=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 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'=>8, // Non-profit
'prHlNum'=>$hlNum, // 99xxxx
'prManID'=>36, // web
'prStat'=>0,
'prHiType'=>1, // 1 Rendelés | 2 Típus Váltás | 3 Frissítés | 4 Auto Friss.
);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`h_programs`",$program);
$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
$hardlockID = $res[0]['hlID'];
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE prHlNum='{$hardlockID}' limit 1");
$programQuery=MySqlHelper::getInstance()->fetchAssoc();
$pwd = $programQuery[0]['prPass'];
}
}
/*******************************************************************************
*BIMLadder-es automata kulcskiadás és program létrehozás
******************************************************************************/
else if (isset($npID) && $npID>'' && isset($partnerID) && $partnerID=='kbl' && isset($idokod) && $idokod>'' && isset($pwd) && $pwd>'')
{
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`nonprofit` WHERE computer_id='".$compid."' AND partnerID = 'kbl' LIMIT 1;");
$res=MySqlHelper::getInstance()->fetchAssoc();
//ba nincs ehhez a gephez meg non-profit program regisztralva
if (empty($res))
{
$hlNum=tryToAlloc($BIMLadderRangeMin,$BIMLadderRangeMax);
$arrIdokod=explode("-", $idokod);
$isid=$arrIdokod[1];
$type=substr($pwd, 6, 1);
$verid=substr($pwd, 7, 2);
$ver=$version->getVersion(array('verPassword8and9'=>$verid));
$interval=30; //ba !!! nem 90!!!
$pass=generatePassword($hlNum,0,$type,$ver['verCode']);
$aktKod=generateTimeCode($pass,$isid,$interval);
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`u_emails` WHERE `email`='{$email}' LIMIT 1;");
$exist=MySqlHelper::getInstance()->fetchAssoc();
if (!$exist) //ba elsodleges szempont, hogy a megadott email cimmel van-e crm bejegyzes
{
//ba felvesszuk a user-t
$userdata=array(
'strName'=>$name,
'strEMail'=>$email,
'strCompany'=>$company,
'strTel'=>$phone,
'old_db'=>'clusers_eng',
'nCtrID'=>82,
'dateInsert'=>$time);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`users`",$userdata);
MySqlHelper::getInstance()->query("SELECT nUserID as nUserID FROM `".CRMADATBAZIS."`.`users` WHERE strEMail='{$email}' AND strName='{$name}' limit 1");
$userQuery=MySqlHelper::getInstance()->fetchAssoc();
$userID = $userQuery[0]['nUserID'];
//ba felvesszuk az email cimet a userhez
$emaildata=array(
'email'=>$email,
'nUserID'=>$userID,
'newsletter'=>$newsletter
);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`u_emails`",$emaildata);
}
else
{
//ba a meglevo userhez fogjuk kotni a programot
$userID=$exist[0]['nUserID'];
}
//ba regisztraljuk hozza a non-profit programot
$nonprofit=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('+30 day', $time)), //ba 30 nap!!!!
'activation_datetime'=>date('Y-m-d H:i:s',$time),
'old_db'=>'clusers_eng',
'partnerID'=>$partnerID,
'enabled'=>'Y',
'computer_id'=>$compid);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`nonprofit`",$nonprofit);
//BIMLadder non-profit kód aktiválás beszúrása crm -> u_history táblába
$esemeny=array(
'nUserID'=>$userID,
'nTopicID'=>368,
'dateEvent'=>date('Y-m-d H:i:s',$time),
'strPlace'=>'',
'strInfo'=>'BIMLadder nonprofit kulcs aktiválás',
'nManagerID'=>36,
'insertDate'=>date('Y-m-d H:i:s',$time));
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`u_history`",$esemeny);
$hardlock=array(
'hlNum'=>$hlNum,
'hlCtrID'=>82,
'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');
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`hardlock`",$hardlock);
$program=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 nap helyett 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'=>9,
'prHlNum'=>$hlNum, // 99xxxx
'prManID'=>36, // web
'prStat'=>0,
'prHiType'=>1, // 1 Rendelés | 2 Típus Váltás | 3 Frissítés | 4 Auto Friss.
);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`h_programs`",$program);
$pwd = $pass; //ba 2018.11.26. mostantol az uj jelszava a usernek a most generalt, 92-es lesz, nem pedig a 91-es!
}
else
{
//ba ehhez a gephez mar volt non-profit regisztracio, keressuk ki a sorozatszamot neki
$hardlockID = $res[0]['hlID'];
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE prHlNum='{$hardlockID}' limit 1");
$programQuery=MySqlHelper::getInstance()->fetchAssoc();
$pwd = $programQuery[0]['prPass'];
}
}
//insert stats to the userstats table
$stats = array(
'usLang' => $user_lang_db,
'usDate' => time(),
'usPwd' => $pwd,
'usVer'=>substr($pwd,7,2),
'usCompID' => $compID,
'usCtrID' => $ctrID,
'usBuild' => $build,
'usCtrName' => $ctrname,
'usIP' => $user_IP,
'usOSData' => $osdata,
// 'usISID' => $isid,
);
$liveKey = $version->isLiveKey($pwd) == 'true'; // Live kulcs 2019
$softwareKey = $version->isSoftwareKey($pwd) == 'true'; // Software kulcs 2019
if($softwareKey)
$stats['usISID'] = substr($idokod, 5, 4);
if (trim($usGCMan)>'' && trim($usGCType)>'' && trim($usGCDriverVer)>'')
{
$arrGCData=array(
'usGCMan'=>trim($usGCMan), // graphic card manufacture
'usGCType'=>trim($usGCType), // graphic card type
'usGCDriverVer'=>trim($usGCDriverVer), // graphic card driver version
);
$stats['usGCMan']=$arrGCData['usGCMan'];
$stats['usGCType']=$arrGCData['usGCType'];
$stats['usGCDriverVer']=$arrGCData['usGCDriverVer'];
}
if($softwareKey)
{
if($liveKey || in_array(substr($pwd,0,2), array('99','98','95')) ) // Azok a programok, amik regisztrálódnak a CRM-ben 2019
{
$msh->query("SELECT hlCtrID FROM ".CRMADATBAZIS.".hardlock WHERE hlNum='".substr($pwd,0,6)."'");
$res=$msh->fetchAssoc();
$hlnum=$res[0];
if(isset($hlnum['hlCtrID'])) $stats['usHlCtrID'] = $hlnum['hlCtrID'];
}
}
else
{
$stats['usHlCtrID'] = substr($pwd,0,2);
}
$msh2->insert('userstats2013',$stats);
$usstatid=$msh2->getInsertedId();
}
else
{
//if ($_SERVER['REMOTE_ADDR']=='188.6.239.155') {print "haha"; die();}
$rec=array(
'hiba'=>"Valami hianyzik: {$pwd}\nlang: {$user_lang_db}\nverzio: {$user_version}\nssID: {$user_ssID}",
'datum'=>date('Y-m-d H:i:s',time())
);
$msh2->insert('a_hibak',$rec);
}
//if ($_SERVER['REMOTE_ADDR']=='188.6.239.155') {var_dump($pwd); die();}
//loading the xml tips if necessary
if(!$settings)
{
print('Unable to load the corresponding settings.xml file!');
$rec=array(
'hiba'=>"beallitas hianyzik: {$pwd}\nlang: {$user_lang_db}\nverzio: {$user_version}\nssID: {$user_ssID}",
'datum'=>date('Y-m-d H:i:s',time())
);
// if($_SERVER['REMOTE_ADDR'] == "188.36.217.1") var_dump($rec);
$msh2->insert('a_hibak',$rec);
}
else
{
if(substr($pwd,7,2)>29 && substr($pwd,0,2)!='96')
{
$isid=($softwareKey ? substr($idokod,5,4) : substr($pwd,0,2).substr($pwd,7,2));
$kulcsszam = substr($pwd,0,6);
$msh->query("SELECT hlStat,hlUser FROM `".CRMADATBAZIS."`.`hardlock` WHERE hlNum='{$kulcsszam}'");
$res=$msh->fetchAssoc();
$kulcs=$res[0];
$aktivalokod = $version->ujaktivalasikod2($pwd,$isid,$idokod);
//if ($_SERVER['REMOTE_ADDR']=='188.6.239.155') {var_dump($aktivalokod); die();}
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
{
$msh->query("SELECT COUNT(*) AS `darab` FROM `".CRMADATBAZIS."`.`h_aktivalas_infok` WHERE kulcs='".$kulcsszam."';");
$tmp=$msh->fetchAssoc();
$darab=(int)$tmp[0]['darab'];
$msh->query("SELECT COUNT(*) AS `darab` FROM `".CRMADATBAZIS."`.`u_history` WHERE `nUserID`=".(int)$kulcs['hlUser']." AND nTopicID IN (314,315);");
$tmp=$msh->fetchAssoc();
$esem=(int)$tmp[0]['darab'];
$msh->query("SELECT * FROM `".CRMADATBAZIS."`.`users` WHERE nUserID='".(int)$kulcs['hlUser']."';");
$usr=$msh->fetchAssoc();
$usr=$usr[0];
if (!empty($usr) && ($darab==0 || $esem==0))
{
$msh->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').': '.$kulcsszam,
'nManagerID'=>36,
'insertDate'=>date('Y-m-d H:i:s'),
));
}
}
$virtualization = ($kulcs['hlStat']=='2' ? "false" : "true"); // letiltott kulcs visszajelzése a programnak
$valasz = ($aktivalokod!="") ? $aktivalokod : "(( nem kapott valaszt ))";
$version->_hibajelento("tips",substr($pwd,0,6),"programinditas - pw: {$pwd}, build: {$build}, isid: {$isid}, időkód: {$idokod}, valasz: ".$valasz,(isset($arrGCData)?$arrGCData:array()),(isset($usstatid)?$usstatid:NULL));
if(is_numeric($usstatid)) $msh2->update("userstats2013",array('valasz'=>$valasz),array('usID'=>$usstatid));
}
//logFilter
$logfilter=0;
if ($pwd>0)
{
$msh->query("SELECT * FROM `".CRMADATBAZIS."`.`h_programs` WHERE `prPass`='".$pwd."' LIMIT 1;");
$res=$msh->fetchAssoc();
$logfilter=$res[0]['prLogFilter'];
}
$verid=substr($pwd, 7, 2);
if($verid >= 36){
$hlnum = substr($pwd,0,6);
MySqlHelper::getInstance()->query("SELECT * FROM `".CRMADATBAZIS."`.`hardlock_computers` WHERE hlNum='".$hlnum."' AND computer_id='".$compid."' LIMIT 1;");
$res=MySqlHelper::getInstance()->fetchAssoc();
if(empty($res)){
$comp=array(
'hlNum'=>$hlnum,
'computer_id'=>$compid);
MySqlHelper::getInstance()->insert("`".CRMADATBAZIS."`.`hardlock_computers`",$comp);
}
}
// if ($_SERVER['REMOTE_ADDR']!='46.139.109.235') return; //ba hibás válaszok ideiglenes kikötése
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="'.$settings->lang.'" version="'.$settings->version.'">
<path>'.str_replace('..','',$mtips->tips_src).$settings->lang.'/'.'</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>
<loginEnabled>'.($kulcsszam=='360006' ? 'true' : 'false').'</loginEnabled>
</Tips>';
}
?>

View File

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>com_alworkshops</name>
<creationDate>2017-04-14</creationDate>
<copyright>2017 Zsolt Fekete</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<author>Zsolt Fekete</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>https://www.facebook.com/mcleod78</authorUrl>
<version>CVS: 1.0.0</version>
<description>Manage workshops</description>
<administration>
<menu img="" link="option=com_alworkshops">COM_ALWORKSHOPS</menu>
<submenu>
<menu img="" alt="COM_ALWORKSHOPS_CONTROL_PANEL_HELP" view="alworkshops" link="option=com_alworkshops&amp;view=alworkshops">COM_ALWORKSHOPS_CONTROL_PANEL_HELP</menu>
<menu img="" alt="COM_ALWORKSHOPS_APPLICATIONS" view="application" link="option=com_alworkshops&amp;view=application">COM_ALWORKSHOPS_APPLICATIONS</menu>
<menu img="" alt="COM_ALWORKSHOPS_COURSES" view="course" link="option=com_alworkshops&amp;view=course">COM_ALWORKSHOPS_COURSES</menu>
<menu img="" alt="COM_ALWORKSHOPS_SESSIONS" view="session" link="option=com_alworkshops&amp;view=session">COM_ALWORKSHOPS_SESSIONS</menu>
<menu img="" alt="COM_ALWORKSHOPS_SWITCH" view="switch" link="option=com_alworkshops&amp;view=switch">COM_ALWORKSHOPS_SWITCH</menu>
<menu img="" alt="COM_ALWORKSHOPS_ONLINE_SESSIONS" view="onlinesession" link="option=com_alworkshops&amp;view=onlinesession">COM_ALWORKSHOPS_ONLINE_SESSIONS</menu>
</submenu>
<files folder="administrator">
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>alworkshops.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="languages/administrator">
<language tag="en-GB">en-GB/en-GB.com_alworkshops.ini</language>
<language tag="en-GB">en-GB/en-GB.com_alworkshops.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.com_alworkshops.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.com_alworkshops.sys.ini</language>
</languages>
</administration>
<config>
<fields name="params">
<fieldset name="component">
<field name="save_history" default="0" />
</fieldset>
</fields>
</config>
</extension>
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>com_alworkshops</name>
<creationDate>2017-04-14</creationDate>
<copyright>2017 Zsolt Fekete</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<author>Zsolt Fekete</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>https://www.facebook.com/mcleod78</authorUrl>
<version>CVS: 1.0.0</version>
<description>Manage workshops</description>
<administration>
<menu img="" link="option=com_alworkshops">COM_ALWORKSHOPS</menu>
<submenu>
<menu img="" alt="COM_ALWORKSHOPS_CONTROL_PANEL_HELP" view="alworkshops" link="option=com_alworkshops&amp;view=alworkshops">COM_ALWORKSHOPS_CONTROL_PANEL_HELP</menu>
<menu img="" alt="COM_ALWORKSHOPS_APPLICATIONS" view="application" link="option=com_alworkshops&amp;view=application">COM_ALWORKSHOPS_APPLICATIONS</menu>
<menu img="" alt="COM_ALWORKSHOPS_COURSES" view="course" link="option=com_alworkshops&amp;view=course">COM_ALWORKSHOPS_COURSES</menu>
<menu img="" alt="COM_ALWORKSHOPS_SESSIONS" view="session" link="option=com_alworkshops&amp;view=session">COM_ALWORKSHOPS_SESSIONS</menu>
<menu img="" alt="COM_ALWORKSHOPS_SWITCH" view="switch" link="option=com_alworkshops&amp;view=switch">COM_ALWORKSHOPS_SWITCH</menu>
<menu img="" alt="COM_ALWORKSHOPS_ONLINE_SESSIONS" view="onlinesession" link="option=com_alworkshops&amp;view=onlinesession">COM_ALWORKSHOPS_ONLINE_SESSIONS</menu>
</submenu>
<files folder="administrator">
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>alworkshops.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="languages/administrator">
<language tag="en-GB">en-GB/en-GB.com_alworkshops.ini</language>
<language tag="en-GB">en-GB/en-GB.com_alworkshops.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.com_alworkshops.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.com_alworkshops.sys.ini</language>
</languages>
</administration>
<config>
<fields name="params">
<fieldset name="component">
<field name="save_history" default="0" />
</fieldset>
</fields>
</config>
</extension>

View File

@ -1,95 +1,95 @@
<?php
require_once('BaseController.class.php');
define('TABLE', '`aleducation_courses`');
class Controller extends BaseController
{
public $pf = 'EducationController';
public $lang;
public function procEvent()
{
if (isset($_POST) && !empty($_POST) && trim($_POST["refresh"]) == "") $_SESSION[$this->pf]["_POST"] = $_POST;
if (!isset($_SESSION[$this->pf]['tableorder']) || trim($_SESSION[$this->pf]['tableorder']) == '') $_SESSION[$this->pf]['tableorder'] = 's.id DESC';
$se = &$_SESSION[$this->pf]['_POST'];
$felt = " AND `lang`='" . ($this->getLang() == 'hu-HU' ? 'hun' : 'eng') . "' ";
$arrIcons = array(
'smallEnable' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','disable','" . $this->targetdiv . "');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','" . $this->targetdiv . "');}", "img" => IconHelper::getIcon("smallEnable")),
'smallDisable' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','enable','" . $this->targetdiv . "');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','" . $this->targetdiv . "');}", 'img' => IconHelper::getIcon("smallDisable")),
'smallEdit' => array("href" => "index.php?option=com_alworkshops&view=educationedit&id=REPLACE", "img" => IconHelper::getIcon("smallEdit"), "linkjoin" => "id", "alttext" => "Edit"),
);
$_LANG = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . "/administrator/language/" . $this->getLang() . "/" . $this->getLang() . ".com_alworkshops.ini");
if (isset($_POST[$this->pf . '_event']) and trim($_POST[$this->pf . '_event']) > '') {
$event = trim(strtolower(addslashes((string)$_POST[$this->pf . '_event'])));
$value = trim(strtolower(addslashes((string)$_POST[$this->pf . '_value'])));
if ((int)$value > 0) {
switch ($event) {
case 'enable': {
MySqlHelper::getInstance()->query("UPDATE " . TABLE . " SET published='Y' WHERE id=" . $value);
break;
}
case 'disable': {
MySqlHelper::getInstance()->query("UPDATE " . TABLE . " SET published='N' WHERE id=" . $value);
break;
}
}
}
}
if (isset($se['sid']) && $se['sid'] > "") {
if (strpos($se['sid'], "-")) {
$reszek = explode("-", $se['sid']);
$felt .= ((int)$reszek[0] < (int)$reszek[1] ? " AND id>=" . (int)$reszek[0] . " AND id<=" . (int)$reszek[1] : " AND id>=" . (int)$reszek[1] . " AND id<=" . (int)$reszek[0]);
} else {
$felt .= " AND id=" . (int)$se['sid'];
}
}
if (isset($se['tipus']) && $se['tipus'] != 'mind') $felt .= " AND `" . $se['tipus'] . "`='Y'";
if (isset($se['alias']) && $se['alias'] > "") $felt .= " AND alias LIKE '%" . trim($se['alias']) . "%' ";
$objTabla = new TableHelper();
$objTabla->setParams(array('prefix' => $this->pf, 'tablewidth' => '100%', 'tablediv' => 'tablediv'));
$v = $objTabla->setSession();
$objTabla->setColumn('id', array('header' => $_LANG['COM_ALWORKSHOPS_ID'], 'width' => '40px', 'format' => 'number', 'decimal' => 0, 'link' => 'index.php?option=com_alworkshops&view=educationedit&id=REPLACE'));
$objTabla->setColumn('options', array('header' => $_LANG['COM_ALWORKSHOPS_OPTIONS'], 'align' => 'right', 'width' => '70px', 'order' => false, 'addicons' => $arrIcons, 'linkjoin' => 'id'));
$objTabla->setQuery(array(
"
SELECT id, title, url, image, published, CONCAT(IF(published='N','smallDisable','smallEnable'),'|','smallEdit') AS options FROM " . TABLE . " s WHERE 1 " . $felt
. ((isset($v['tableorder']) and $v['tableorder'] > '') ? ' ORDER BY ' . $v['tableorder'] : '')
. ((isset($v['tableipp'])) ? ' LIMIT ' . ($v['tableipp'] > 0 ? ($v['tablepage'] - 1) * $v['tableipp'] : 0) . ',' . $v['tableipp'] : ''), "
SELECT COUNT(*) AS recordCount
FROM (
SELECT id, title, url, image, published, CONCAT(IF(published='N','smallDisable','smallEnable'),'|','smallEdit') AS options FROM " . TABLE . " s WHERE 1 " . $felt . ") z;"
));
//print_r($objTabla->arrQuery);
$objTabla->drawTable(TRUE);
}
public function getLang()
{
if (!isset($this->lang)) {
$this->lang = (strpos($_SERVER['HTTP_HOST'], ".com") ? "en-GB" : "hu-HU");
}
return $this->lang;
}
}
$controller = new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value', '');
<?php if (!isset($_POST['nojs'])) : ?>
jQuery("#title").attr('value', '<?= $_SESSION[$controller->pf]["_POST"]["title"] ?>');
jQuery("#sid").attr('value', '<?= $_SESSION[$controller->pf]["_POST"]["sid"] ?>');
jQuery("input[name=published]").each(function() {
if (jQuery(this).val() == '<?= $_SESSION[$controller->pf]["_POST"]["published"] ?>') {
jQuery(this).attr('checked', 'checked');
}
});
<?php endif; ?>
<?php
require_once('BaseController.class.php');
define('TABLE', '`aleducation_courses`');
class Controller extends BaseController
{
public $pf = 'EducationController';
public $lang;
public function procEvent()
{
if (isset($_POST) && !empty($_POST) && trim($_POST["refresh"]) == "") $_SESSION[$this->pf]["_POST"] = $_POST;
if (!isset($_SESSION[$this->pf]['tableorder']) || trim($_SESSION[$this->pf]['tableorder']) == '') $_SESSION[$this->pf]['tableorder'] = 's.id DESC';
$se = &$_SESSION[$this->pf]['_POST'];
$felt = " AND `lang`='" . ($this->getLang() == 'hu-HU' ? 'hun' : 'eng') . "' ";
$arrIcons = array(
'smallEnable' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','disable','" . $this->targetdiv . "');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','" . $this->targetdiv . "');}", "img" => IconHelper::getIcon("smallEnable")),
'smallDisable' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','enable','" . $this->targetdiv . "');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','" . $this->targetdiv . "');}", 'img' => IconHelper::getIcon("smallDisable")),
'smallEdit' => array("href" => "index.php?option=com_alworkshops&view=educationedit&id=REPLACE", "img" => IconHelper::getIcon("smallEdit"), "linkjoin" => "id", "alttext" => "Edit"),
);
$_LANG = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . "/administrator/language/" . $this->getLang() . "/" . $this->getLang() . ".com_alworkshops.ini");
if (isset($_POST[$this->pf . '_event']) and trim($_POST[$this->pf . '_event']) > '') {
$event = trim(strtolower(addslashes((string)$_POST[$this->pf . '_event'])));
$value = trim(strtolower(addslashes((string)$_POST[$this->pf . '_value'])));
if ((int)$value > 0) {
switch ($event) {
case 'enable': {
MySqlHelper::getInstance()->query("UPDATE " . TABLE . " SET published='Y' WHERE id=" . $value);
break;
}
case 'disable': {
MySqlHelper::getInstance()->query("UPDATE " . TABLE . " SET published='N' WHERE id=" . $value);
break;
}
}
}
}
if (isset($se['sid']) && $se['sid'] > "") {
if (strpos($se['sid'], "-")) {
$reszek = explode("-", $se['sid']);
$felt .= ((int)$reszek[0] < (int)$reszek[1] ? " AND id>=" . (int)$reszek[0] . " AND id<=" . (int)$reszek[1] : " AND id>=" . (int)$reszek[1] . " AND id<=" . (int)$reszek[0]);
} else {
$felt .= " AND id=" . (int)$se['sid'];
}
}
if (isset($se['tipus']) && $se['tipus'] != 'mind') $felt .= " AND `" . $se['tipus'] . "`='Y'";
if (isset($se['alias']) && $se['alias'] > "") $felt .= " AND alias LIKE '%" . trim($se['alias']) . "%' ";
$objTabla = new TableHelper();
$objTabla->setParams(array('prefix' => $this->pf, 'tablewidth' => '100%', 'tablediv' => 'tablediv'));
$v = $objTabla->setSession();
$objTabla->setColumn('id', array('header' => $_LANG['COM_ALWORKSHOPS_ID'], 'width' => '40px', 'format' => 'number', 'decimal' => 0, 'link' => 'index.php?option=com_alworkshops&view=educationedit&id=REPLACE'));
$objTabla->setColumn('options', array('header' => $_LANG['COM_ALWORKSHOPS_OPTIONS'], 'align' => 'right', 'width' => '70px', 'order' => false, 'addicons' => $arrIcons, 'linkjoin' => 'id'));
$objTabla->setQuery(array(
"
SELECT id, title, url, image, published, CONCAT(IF(published='N','smallDisable','smallEnable'),'|','smallEdit') AS options FROM " . TABLE . " s WHERE 1 " . $felt
. ((isset($v['tableorder']) and $v['tableorder'] > '') ? ' ORDER BY ' . $v['tableorder'] : '')
. ((isset($v['tableipp'])) ? ' LIMIT ' . ($v['tableipp'] > 0 ? ($v['tablepage'] - 1) * $v['tableipp'] : 0) . ',' . $v['tableipp'] : ''), "
SELECT COUNT(*) AS recordCount
FROM (
SELECT id, title, url, image, published, CONCAT(IF(published='N','smallDisable','smallEnable'),'|','smallEdit') AS options FROM " . TABLE . " s WHERE 1 " . $felt . ") z;"
));
//print_r($objTabla->arrQuery);
$objTabla->drawTable(TRUE);
}
public function getLang()
{
if (!isset($this->lang)) {
$this->lang = (strpos($_SERVER['HTTP_HOST'], ".com") ? "en-GB" : "hu-HU");
}
return $this->lang;
}
}
$controller = new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value', '');
<?php if (!isset($_POST['nojs'])) : ?>
jQuery("#title").attr('value', '<?= $_SESSION[$controller->pf]["_POST"]["title"] ?>');
jQuery("#sid").attr('value', '<?= $_SESSION[$controller->pf]["_POST"]["sid"] ?>');
jQuery("input[name=published]").each(function() {
if (jQuery(this).val() == '<?= $_SESSION[$controller->pf]["_POST"]["published"] ?>') {
jQuery(this).attr('checked', 'checked');
}
});
<?php endif; ?>
</script>

View File

@ -1,130 +1,130 @@
<?php
require_once('BaseController.class.php');
define('TABLE','`alworkshops_online_sessions`');
class Controller extends BaseController {
public $pf='OnlineSessionController';
public $lang;
public $targetdiv='tablediv';
public function procEvent()
{
if (isset($_POST) && !empty($_POST) && trim($_POST["refresh"])=="") $_SESSION[$this->pf]["_POST"]=$_POST;
if (isset($_POST['targetdiv'])) $this->targetdiv=$_POST['targetdiv'];
if (!isset($_SESSION[$this->pf]['tableorder']) || trim($_SESSION[$this->pf]['tableorder'])=='' ) $_SESSION[$this->pf]['tableorder']='s.id DESC';
$se=&$_SESSION[$this->pf]['_POST'];
if($this->getLang() == 'hu-HU') {
$webinar = "webinariumok";
} else {
$webinar = "webinars";
}
$felt=" AND c.`alias`='{$webinar}' ";
$arrIcons=array(
'smallEnable'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','disable','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}","img"=>IconHelper::getIcon("smallEnable") ),
'smallDisable'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','enable','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}",'img'=>IconHelper::getIcon("smallDisable") ),
'smallEdit'=>array("href"=>"index.php?option=com_alworkshops&view=onlinesessionedit&id=REPLACE", "img"=>IconHelper::getIcon("smallEdit"), "linkjoin"=>"id","alttext"=>"Edit" ),
);
$_LANG=parse_ini_file($_SERVER['DOCUMENT_ROOT']."/administrator/language/".$this->getLang()."/".$this->getLang().".com_alworkshops.ini");
if (isset($_POST[$this->pf.'_event']) and trim($_POST[$this->pf.'_event'])>'')
{
$event=trim(strtolower(addslashes((string)$_POST[$this->pf.'_event'])));
$value=trim(strtolower(addslashes((string)$_POST[$this->pf.'_value'])));
if ((int)$value>0)
{
switch ($event)
{
case 'enable' : { MySqlHelper::getInstance()->query("UPDATE ".TABLE." SET published='Y' WHERE id=".$value);break; }
case 'disable' : { MySqlHelper::getInstance()->query("UPDATE ".TABLE." SET published='N' WHERE id=".$value);break; }
}
}
}
if (isset($se['sid']) && $se['sid']>"")
{
if (strpos($se['sid'], "-"))
{
$reszek=explode("-", $se['sid']);
$felt.=( (int)$reszek[0]<(int)$reszek[1] ? " AND id>=".(int)$reszek[0]." AND id<=".(int)$reszek[1] : " AND id>=".(int)$reszek[1]." AND id<=".(int)$reszek[0]);
}
else
{
$felt.=" AND id=".(int)$se['sid'];
}
}
if (isset($se['wid']) && $se['wid']>"")
{
if (strpos($se['wid'], "-"))
{
$reszek=explode("-", $se['wid']);
$felt.=( (int)$reszek[0]<(int)$reszek[1] ? " AND courseid>=".(int)$reszek[0]." AND courseid<=".(int)$reszek[1] : " AND courseid>=".(int)$reszek[1]." AND courseid<=".(int)$reszek[0]);
}
else
{
$felt.=" AND courseid=".(int)$se['wid'];
}
}
if (isset($se['title']) && $se['title']>"") $felt.=" AND title LIKE '%".trim($se['title'])."%' ";
if (isset($se['start_date']) && $se['start_date']>"") $felt.=" AND session_date>='".trim($se['start_date'])."'";
if (isset($se['finish_date']) && $se['finish_date']>"") $felt.=" AND session_date<='".trim($se['finish_date'])."'";
if (isset($se['published']) && $se['published']!='A') $felt.=" AND published='".$se['published']."'";
$objTabla=New TableHelper();
$objTabla->setParams(array('prefix'=>$this->pf,'tablewidth'=>'100%','tablediv'=>$this->targetdiv));
$v=$objTabla->setSession();
$objTabla->setColumn('id',array('header'=>'SID','width'=>'50px','format'=>'number','decimal'=>0,'link'=>'index.php?option=com_alworkshops&view=onlinesessionedit&id=REPLACE'));
$objTabla->setColumn('courseid',array('header'=>'CID','align'=>'center','width'=>'50px','format'=>'number','decimal'=>0));
$objTabla->setColumn('title',array('header'=>$_LANG['COM_ALWORKSHOPS_TITLE'],'width'=>'200px'));
$objTabla->setColumn('session_date',array('header'=>$_LANG['COM_ALWORKSHOPS_START_DATE'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('start_time',array('header'=>$_LANG['COM_ALWORKSHOPS_START_TIME'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('finish_time',array('header'=>$_LANG['COM_ALWORKSHOPS_FINISH_TIME'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('duration',array('header'=>$_LANG['COM_ALWORKSHOPS_DURATION'],'align'=>'center','width'=>'60px'));
$objTabla->setColumn('ordering',array('header'=>$_LANG['COM_ALWORKSHOPS_ORDERING'],'width'=>'70px','format'=>'number','decimal'=>0));
$objTabla->setColumn('published',array('header'=>$_LANG['COM_ALWORKSHOPS_PUBLISHED'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('options',array('header'=>$_LANG['COM_ALWORKSHOPS_OPTIONS'],'align'=>'right','width'=>'70px','order'=>false,'addicons'=>$arrIcons,'linkjoin'=>'id'));
$objTabla->setQuery(array("
SELECT s.*,CONCAT(IF(s.published='N','smallDisable','smallEnable'),'|','smallEdit') AS options
FROM alworkshops_online_sessions s
LEFT OUTER JOIN alworkshops_courses c ON c.id=s.courseid
WHERE 1 ".$felt
.((isset($v['tableorder']) and $v['tableorder']>'') ? ' ORDER BY '.$v['tableorder'] : '')
.((isset($v['tableipp'])) ? ' LIMIT '.($v['tableipp']>0 ? ($v['tablepage']-1)*$v['tableipp'] : 0) .','.$v['tableipp'] : ''),"
SELECT COUNT(*) AS recordCount
FROM (
SELECT s.*,CONCAT(IF(s.published='N','smallDisable','smallEnable'),'|','smallEdit') AS options
FROM alworkshops_online_sessions s
LEFT OUTER JOIN alworkshops_courses c ON c.id=s.courseid
WHERE 1 ".$felt.") z;"
));
$objTabla->drawTable(TRUE);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=(strpos($_SERVER['HTTP_HOST'],".com") ? "en-GB" : "hu-HU"); }
return $this->lang;
}
}
$controller=new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value','');
<?php if (!isset($_POST['nojs'])):?>
jQuery("#title").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["title"]?>');
jQuery("#sid").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["sid"]?>');
jQuery("#wid").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["wid"]?>');
jQuery("#description").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["description"]?>');
jQuery("#start_date").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["start_date"]?>');
jQuery("#finish_date").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["finish_date"]?>');
jQuery("input[name=published]").each(function() {
if (jQuery(this).val()=='<?=$_SESSION[$controller->pf]["_POST"]["published"]?>') { jQuery(this).attr('checked','checked'); }
});
<?php endif;?>
</script>
<?php
require_once('BaseController.class.php');
define('TABLE','`alworkshops_online_sessions`');
class Controller extends BaseController {
public $pf='OnlineSessionController';
public $lang;
public $targetdiv='tablediv';
public function procEvent()
{
if (isset($_POST) && !empty($_POST) && trim($_POST["refresh"])=="") $_SESSION[$this->pf]["_POST"]=$_POST;
if (isset($_POST['targetdiv'])) $this->targetdiv=$_POST['targetdiv'];
if (!isset($_SESSION[$this->pf]['tableorder']) || trim($_SESSION[$this->pf]['tableorder'])=='' ) $_SESSION[$this->pf]['tableorder']='s.id DESC';
$se=&$_SESSION[$this->pf]['_POST'];
if($this->getLang() == 'hu-HU') {
$webinar = "webinariumok";
} else {
$webinar = "webinars";
}
$felt=" AND c.`alias`='{$webinar}' ";
$arrIcons=array(
'smallEnable'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','disable','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}","img"=>IconHelper::getIcon("smallEnable") ),
'smallDisable'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','enable','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}",'img'=>IconHelper::getIcon("smallDisable") ),
'smallEdit'=>array("href"=>"index.php?option=com_alworkshops&view=onlinesessionedit&id=REPLACE", "img"=>IconHelper::getIcon("smallEdit"), "linkjoin"=>"id","alttext"=>"Edit" ),
);
$_LANG=parse_ini_file($_SERVER['DOCUMENT_ROOT']."/administrator/language/".$this->getLang()."/".$this->getLang().".com_alworkshops.ini");
if (isset($_POST[$this->pf.'_event']) and trim($_POST[$this->pf.'_event'])>'')
{
$event=trim(strtolower(addslashes((string)$_POST[$this->pf.'_event'])));
$value=trim(strtolower(addslashes((string)$_POST[$this->pf.'_value'])));
if ((int)$value>0)
{
switch ($event)
{
case 'enable' : { MySqlHelper::getInstance()->query("UPDATE ".TABLE." SET published='Y' WHERE id=".$value);break; }
case 'disable' : { MySqlHelper::getInstance()->query("UPDATE ".TABLE." SET published='N' WHERE id=".$value);break; }
}
}
}
if (isset($se['sid']) && $se['sid']>"")
{
if (strpos($se['sid'], "-"))
{
$reszek=explode("-", $se['sid']);
$felt.=( (int)$reszek[0]<(int)$reszek[1] ? " AND id>=".(int)$reszek[0]." AND id<=".(int)$reszek[1] : " AND id>=".(int)$reszek[1]." AND id<=".(int)$reszek[0]);
}
else
{
$felt.=" AND id=".(int)$se['sid'];
}
}
if (isset($se['wid']) && $se['wid']>"")
{
if (strpos($se['wid'], "-"))
{
$reszek=explode("-", $se['wid']);
$felt.=( (int)$reszek[0]<(int)$reszek[1] ? " AND courseid>=".(int)$reszek[0]." AND courseid<=".(int)$reszek[1] : " AND courseid>=".(int)$reszek[1]." AND courseid<=".(int)$reszek[0]);
}
else
{
$felt.=" AND courseid=".(int)$se['wid'];
}
}
if (isset($se['title']) && $se['title']>"") $felt.=" AND title LIKE '%".trim($se['title'])."%' ";
if (isset($se['start_date']) && $se['start_date']>"") $felt.=" AND session_date>='".trim($se['start_date'])."'";
if (isset($se['finish_date']) && $se['finish_date']>"") $felt.=" AND session_date<='".trim($se['finish_date'])."'";
if (isset($se['published']) && $se['published']!='A') $felt.=" AND published='".$se['published']."'";
$objTabla=New TableHelper();
$objTabla->setParams(array('prefix'=>$this->pf,'tablewidth'=>'100%','tablediv'=>$this->targetdiv));
$v=$objTabla->setSession();
$objTabla->setColumn('id',array('header'=>'SID','width'=>'50px','format'=>'number','decimal'=>0,'link'=>'index.php?option=com_alworkshops&view=onlinesessionedit&id=REPLACE'));
$objTabla->setColumn('courseid',array('header'=>'CID','align'=>'center','width'=>'50px','format'=>'number','decimal'=>0));
$objTabla->setColumn('title',array('header'=>$_LANG['COM_ALWORKSHOPS_TITLE'],'width'=>'200px'));
$objTabla->setColumn('session_date',array('header'=>$_LANG['COM_ALWORKSHOPS_START_DATE'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('start_time',array('header'=>$_LANG['COM_ALWORKSHOPS_START_TIME'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('finish_time',array('header'=>$_LANG['COM_ALWORKSHOPS_FINISH_TIME'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('duration',array('header'=>$_LANG['COM_ALWORKSHOPS_DURATION'],'align'=>'center','width'=>'60px'));
$objTabla->setColumn('ordering',array('header'=>$_LANG['COM_ALWORKSHOPS_ORDERING'],'width'=>'70px','format'=>'number','decimal'=>0));
$objTabla->setColumn('published',array('header'=>$_LANG['COM_ALWORKSHOPS_PUBLISHED'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('options',array('header'=>$_LANG['COM_ALWORKSHOPS_OPTIONS'],'align'=>'right','width'=>'70px','order'=>false,'addicons'=>$arrIcons,'linkjoin'=>'id'));
$objTabla->setQuery(array("
SELECT s.*,CONCAT(IF(s.published='N','smallDisable','smallEnable'),'|','smallEdit') AS options
FROM alworkshops_online_sessions s
LEFT OUTER JOIN alworkshops_courses c ON c.id=s.courseid
WHERE 1 ".$felt
.((isset($v['tableorder']) and $v['tableorder']>'') ? ' ORDER BY '.$v['tableorder'] : '')
.((isset($v['tableipp'])) ? ' LIMIT '.($v['tableipp']>0 ? ($v['tablepage']-1)*$v['tableipp'] : 0) .','.$v['tableipp'] : ''),"
SELECT COUNT(*) AS recordCount
FROM (
SELECT s.*,CONCAT(IF(s.published='N','smallDisable','smallEnable'),'|','smallEdit') AS options
FROM alworkshops_online_sessions s
LEFT OUTER JOIN alworkshops_courses c ON c.id=s.courseid
WHERE 1 ".$felt.") z;"
));
$objTabla->drawTable(TRUE);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=(strpos($_SERVER['HTTP_HOST'],".com") ? "en-GB" : "hu-HU"); }
return $this->lang;
}
}
$controller=new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value','');
<?php if (!isset($_POST['nojs'])):?>
jQuery("#title").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["title"]?>');
jQuery("#sid").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["sid"]?>');
jQuery("#wid").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["wid"]?>');
jQuery("#description").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["description"]?>');
jQuery("#start_date").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["start_date"]?>');
jQuery("#finish_date").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["finish_date"]?>');
jQuery("input[name=published]").each(function() {
if (jQuery(this).val()=='<?=$_SESSION[$controller->pf]["_POST"]["published"]?>') { jQuery(this).attr('checked','checked'); }
});
<?php endif;?>
</script>

View File

@ -1,130 +1,130 @@
<?php
require_once('BaseController.class.php');
define('TABLE','`alworkshops_sessions`');
class Controller extends BaseController {
public $pf='SessionController';
public $lang;
public $targetdiv='tablediv';
public function procEvent()
{
if (isset($_POST) && !empty($_POST) && trim($_POST["refresh"])=="") $_SESSION[$this->pf]["_POST"]=$_POST;
if (isset($_POST['targetdiv'])) $this->targetdiv=$_POST['targetdiv'];
if (!isset($_SESSION[$this->pf]['tableorder']) || trim($_SESSION[$this->pf]['tableorder'])=='' ) $_SESSION[$this->pf]['tableorder']='s.id DESC';
$se=&$_SESSION[$this->pf]['_POST'];
$felt=" AND sw.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."' ";
$arrIcons=array(
'smallEnable'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','disable','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}","img"=>IconHelper::getIcon("smallEnable") ),
'smallDisable'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','enable','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}",'img'=>IconHelper::getIcon("smallDisable") ),
'smallEdit'=>array("href"=>"index.php?option=com_alworkshops&view=sessionedit&id=REPLACE", "img"=>IconHelper::getIcon("smallEdit"), "linkjoin"=>"id","alttext"=>"Edit" ),
);
$_LANG=parse_ini_file($_SERVER['DOCUMENT_ROOT']."/administrator/language/".$this->getLang()."/".$this->getLang().".com_alworkshops.ini");
if (isset($_POST[$this->pf.'_event']) and trim($_POST[$this->pf.'_event'])>'')
{
$event=trim(strtolower(addslashes((string)$_POST[$this->pf.'_event'])));
$value=trim(strtolower(addslashes((string)$_POST[$this->pf.'_value'])));
if ((int)$value>0)
{
switch ($event)
{
case 'enable' : { MySqlHelper::getInstance()->query("UPDATE ".TABLE." SET published='Y' WHERE id=".$value);break; }
case 'disable' : { MySqlHelper::getInstance()->query("UPDATE ".TABLE." SET published='N' WHERE id=".$value);break; }
}
}
}
if (isset($se['sid']) && $se['sid']>"")
{
if (strpos($se['sid'], "-"))
{
$reszek=explode("-", $se['sid']);
$felt.=( (int)$reszek[0]<(int)$reszek[1] ? " AND id>=".(int)$reszek[0]." AND id<=".(int)$reszek[1] : " AND id>=".(int)$reszek[1]." AND id<=".(int)$reszek[0]);
}
else
{
$felt.=" AND id=".(int)$se['sid'];
}
}
if (isset($se['wid']) && $se['wid']>"")
{
if (strpos($se['wid'], "-"))
{
$reszek=explode("-", $se['wid']);
$felt.=( (int)$reszek[0]<(int)$reszek[1] ? " AND courseid>=".(int)$reszek[0]." AND courseid<=".(int)$reszek[1] : " AND courseid>=".(int)$reszek[1]." AND courseid<=".(int)$reszek[0]);
}
else
{
$felt.=" AND courseid=".(int)$se['wid'];
}
}
if (isset($se['title']) && $se['title']>"") $felt.=" AND title LIKE '%".trim($se['title'])."%' ";
if (isset($se['description']) && $se['description']>"") $felt.=" AND description LIKE '%".trim($se['description'])."%' ";
if (isset($se['start_date']) && $se['start_date']>"") $felt.=" AND session_date>='".trim($se['start_date'])."'";
if (isset($se['finish_date']) && $se['finish_date']>"") $felt.=" AND session_date<='".trim($se['finish_date'])."'";
if (isset($se['published']) && $se['published']!='A') $felt.=" AND published='".$se['published']."'";
$felt .= " GROUP BY id";
$objTabla=New TableHelper();
$objTabla->setParams(array('prefix'=>$this->pf,'tablewidth'=>'100%','tablediv'=>$this->targetdiv));
$v=$objTabla->setSession();
$objTabla->setColumn('id',array('header'=>'SID','width'=>'50px','format'=>'number','decimal'=>0,'link'=>'index.php?option=com_alworkshops&view=sessionedit&id=REPLACE'));
$objTabla->setColumn('switchid',array('header'=>'SID','align'=>'center','width'=>'50px','format'=>'number','decimal'=>0));
$objTabla->setColumn('courseid',array('header'=>'CID','align'=>'center','width'=>'50px','format'=>'number','decimal'=>0));
$objTabla->setColumn('title',array('header'=>$_LANG['COM_ALWORKSHOPS_TITLE'],'width'=>'200px'));
$objTabla->setColumn('session_date',array('header'=>$_LANG['COM_ALWORKSHOPS_START_DATE'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('start_time',array('header'=>$_LANG['COM_ALWORKSHOPS_START_TIME'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('finish_time',array('header'=>$_LANG['COM_ALWORKSHOPS_FINISH_TIME'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('duration',array('header'=>$_LANG['COM_ALWORKSHOPS_DURATION'],'align'=>'center','width'=>'60px'));
$objTabla->setColumn('description',array('header'=>$_LANG['COM_ALWORKSHOPS_SESSIONDESC']));
$objTabla->setColumn('ordering',array('header'=>$_LANG['COM_ALWORKSHOPS_ORDERING'],'width'=>'70px','format'=>'number','decimal'=>0));
$objTabla->setColumn('published',array('header'=>$_LANG['COM_ALWORKSHOPS_PUBLISHED'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('options',array('header'=>$_LANG['COM_ALWORKSHOPS_OPTIONS'],'align'=>'right','width'=>'70px','order'=>false,'addicons'=>$arrIcons,'linkjoin'=>'id'));
$objTabla->setQuery(array("
SELECT s.*,CONCAT(IF(s.published='N','smallDisable','smallEnable'),'|','smallEdit') AS options
FROM alworkshops_sessions s
LEFT OUTER JOIN alworkshops_courses c ON c.id=s.courseid
LEFT OUTER JOIN alworkshops_switch sw ON sw.alias=c.alias
WHERE 1 ".$felt
.((isset($v['tableorder']) and $v['tableorder']>'') ? ' ORDER BY '.$v['tableorder'] : '')
.((isset($v['tableipp'])) ? ' LIMIT '.($v['tableipp']>0 ? ($v['tablepage']-1)*$v['tableipp'] : 0) .','.$v['tableipp'] : ''),"
SELECT COUNT(*) AS recordCount
FROM (
SELECT s.*,CONCAT(IF(s.published='N','smallDisable','smallEnable'),'|','smallEdit') AS options
FROM alworkshops_sessions s
LEFT OUTER JOIN alworkshops_courses c ON c.id=s.courseid
LEFT OUTER JOIN alworkshops_switch sw ON sw.alias=c.alias
WHERE 1 ".$felt.") z;"
));
$objTabla->drawTable(TRUE);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=(strpos($_SERVER['HTTP_HOST'],".com") ? "en-GB" : "hu-HU"); }
return $this->lang;
}
}
$controller=new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value','');
<?php if (!isset($_POST['nojs'])):?>
jQuery("#title").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["title"]?>');
jQuery("#sid").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["sid"]?>');
jQuery("#wid").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["wid"]?>');
jQuery("#description").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["description"]?>');
jQuery("#start_date").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["start_date"]?>');
jQuery("#finish_date").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["finish_date"]?>');
jQuery("input[name=published]").each(function() {
if (jQuery(this).val()=='<?=$_SESSION[$controller->pf]["_POST"]["published"]?>') { jQuery(this).attr('checked','checked'); }
});
<?php endif;?>
</script>
<?php
require_once('BaseController.class.php');
define('TABLE','`alworkshops_sessions`');
class Controller extends BaseController {
public $pf='SessionController';
public $lang;
public $targetdiv='tablediv';
public function procEvent()
{
if (isset($_POST) && !empty($_POST) && trim($_POST["refresh"])=="") $_SESSION[$this->pf]["_POST"]=$_POST;
if (isset($_POST['targetdiv'])) $this->targetdiv=$_POST['targetdiv'];
if (!isset($_SESSION[$this->pf]['tableorder']) || trim($_SESSION[$this->pf]['tableorder'])=='' ) $_SESSION[$this->pf]['tableorder']='s.id DESC';
$se=&$_SESSION[$this->pf]['_POST'];
$felt=" AND sw.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."' ";
$arrIcons=array(
'smallEnable'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','disable','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}","img"=>IconHelper::getIcon("smallEnable") ),
'smallDisable'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','enable','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}",'img'=>IconHelper::getIcon("smallDisable") ),
'smallEdit'=>array("href"=>"index.php?option=com_alworkshops&view=sessionedit&id=REPLACE", "img"=>IconHelper::getIcon("smallEdit"), "linkjoin"=>"id","alttext"=>"Edit" ),
);
$_LANG=parse_ini_file($_SERVER['DOCUMENT_ROOT']."/administrator/language/".$this->getLang()."/".$this->getLang().".com_alworkshops.ini");
if (isset($_POST[$this->pf.'_event']) and trim($_POST[$this->pf.'_event'])>'')
{
$event=trim(strtolower(addslashes((string)$_POST[$this->pf.'_event'])));
$value=trim(strtolower(addslashes((string)$_POST[$this->pf.'_value'])));
if ((int)$value>0)
{
switch ($event)
{
case 'enable' : { MySqlHelper::getInstance()->query("UPDATE ".TABLE." SET published='Y' WHERE id=".$value);break; }
case 'disable' : { MySqlHelper::getInstance()->query("UPDATE ".TABLE." SET published='N' WHERE id=".$value);break; }
}
}
}
if (isset($se['sid']) && $se['sid']>"")
{
if (strpos($se['sid'], "-"))
{
$reszek=explode("-", $se['sid']);
$felt.=( (int)$reszek[0]<(int)$reszek[1] ? " AND id>=".(int)$reszek[0]." AND id<=".(int)$reszek[1] : " AND id>=".(int)$reszek[1]." AND id<=".(int)$reszek[0]);
}
else
{
$felt.=" AND id=".(int)$se['sid'];
}
}
if (isset($se['wid']) && $se['wid']>"")
{
if (strpos($se['wid'], "-"))
{
$reszek=explode("-", $se['wid']);
$felt.=( (int)$reszek[0]<(int)$reszek[1] ? " AND courseid>=".(int)$reszek[0]." AND courseid<=".(int)$reszek[1] : " AND courseid>=".(int)$reszek[1]." AND courseid<=".(int)$reszek[0]);
}
else
{
$felt.=" AND courseid=".(int)$se['wid'];
}
}
if (isset($se['title']) && $se['title']>"") $felt.=" AND title LIKE '%".trim($se['title'])."%' ";
if (isset($se['description']) && $se['description']>"") $felt.=" AND description LIKE '%".trim($se['description'])."%' ";
if (isset($se['start_date']) && $se['start_date']>"") $felt.=" AND session_date>='".trim($se['start_date'])."'";
if (isset($se['finish_date']) && $se['finish_date']>"") $felt.=" AND session_date<='".trim($se['finish_date'])."'";
if (isset($se['published']) && $se['published']!='A') $felt.=" AND published='".$se['published']."'";
$felt .= " GROUP BY id";
$objTabla=New TableHelper();
$objTabla->setParams(array('prefix'=>$this->pf,'tablewidth'=>'100%','tablediv'=>$this->targetdiv));
$v=$objTabla->setSession();
$objTabla->setColumn('id',array('header'=>'SID','width'=>'50px','format'=>'number','decimal'=>0,'link'=>'index.php?option=com_alworkshops&view=sessionedit&id=REPLACE'));
$objTabla->setColumn('switchid',array('header'=>'SID','align'=>'center','width'=>'50px','format'=>'number','decimal'=>0));
$objTabla->setColumn('courseid',array('header'=>'CID','align'=>'center','width'=>'50px','format'=>'number','decimal'=>0));
$objTabla->setColumn('title',array('header'=>$_LANG['COM_ALWORKSHOPS_TITLE'],'width'=>'200px'));
$objTabla->setColumn('session_date',array('header'=>$_LANG['COM_ALWORKSHOPS_START_DATE'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('start_time',array('header'=>$_LANG['COM_ALWORKSHOPS_START_TIME'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('finish_time',array('header'=>$_LANG['COM_ALWORKSHOPS_FINISH_TIME'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('duration',array('header'=>$_LANG['COM_ALWORKSHOPS_DURATION'],'align'=>'center','width'=>'60px'));
$objTabla->setColumn('description',array('header'=>$_LANG['COM_ALWORKSHOPS_SESSIONDESC']));
$objTabla->setColumn('ordering',array('header'=>$_LANG['COM_ALWORKSHOPS_ORDERING'],'width'=>'70px','format'=>'number','decimal'=>0));
$objTabla->setColumn('published',array('header'=>$_LANG['COM_ALWORKSHOPS_PUBLISHED'],'align'=>'center','width'=>'80px'));
$objTabla->setColumn('options',array('header'=>$_LANG['COM_ALWORKSHOPS_OPTIONS'],'align'=>'right','width'=>'70px','order'=>false,'addicons'=>$arrIcons,'linkjoin'=>'id'));
$objTabla->setQuery(array("
SELECT s.*,CONCAT(IF(s.published='N','smallDisable','smallEnable'),'|','smallEdit') AS options
FROM alworkshops_sessions s
LEFT OUTER JOIN alworkshops_courses c ON c.id=s.courseid
LEFT OUTER JOIN alworkshops_switch sw ON sw.alias=c.alias
WHERE 1 ".$felt
.((isset($v['tableorder']) and $v['tableorder']>'') ? ' ORDER BY '.$v['tableorder'] : '')
.((isset($v['tableipp'])) ? ' LIMIT '.($v['tableipp']>0 ? ($v['tablepage']-1)*$v['tableipp'] : 0) .','.$v['tableipp'] : ''),"
SELECT COUNT(*) AS recordCount
FROM (
SELECT s.*,CONCAT(IF(s.published='N','smallDisable','smallEnable'),'|','smallEdit') AS options
FROM alworkshops_sessions s
LEFT OUTER JOIN alworkshops_courses c ON c.id=s.courseid
LEFT OUTER JOIN alworkshops_switch sw ON sw.alias=c.alias
WHERE 1 ".$felt.") z;"
));
$objTabla->drawTable(TRUE);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=(strpos($_SERVER['HTTP_HOST'],".com") ? "en-GB" : "hu-HU"); }
return $this->lang;
}
}
$controller=new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value','');
<?php if (!isset($_POST['nojs'])):?>
jQuery("#title").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["title"]?>');
jQuery("#sid").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["sid"]?>');
jQuery("#wid").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["wid"]?>');
jQuery("#description").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["description"]?>');
jQuery("#start_date").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["start_date"]?>');
jQuery("#finish_date").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["finish_date"]?>');
jQuery("input[name=published]").each(function() {
if (jQuery(this).val()=='<?=$_SESSION[$controller->pf]["_POST"]["published"]?>') { jQuery(this).attr('checked','checked'); }
});
<?php endif;?>
</script>

View File

@ -1,86 +1,86 @@
#j-sidebar-container {display:inline-block;vertical-align:top;width:14.5%;height:300px;border:0px solid #000000;}
#j-main-container {display:inline-block;vertical-align:top;width:85%;border:0px solid #000000;}
#j-main-container .pagination {margin:0px;padding:0px;display:inline;}
#j-main-container table.adminlist {width:100%;border-spacing:1px;background-color:#e7e7e7;color:#666;}
#j-main-container table.adminlist td,
#j-main-container table.adminlist th {padding:4px;}
#j-main-container table.adminlist thead th {text-align:center;background:#f0f0f0;color:#666;border-bottom:1px solid #999;border-left:1px solid #fff;}
#j-main-container table.adminlist thead a:hover { text-decoration: none; }
#j-main-container table.adminlist thead th img { vertical-align: middle; }
#j-main-container table.adminlist tbody th { font-weight: bold; }
#j-main-container table.adminlist tbody tr { background-color: #fff; text-align: left; }
#j-main-container table.adminlist tbody tr.row1 { background: #f9f9f9; border-top: 1px solid #fff; }
#j-main-container table.adminlist tbody tr.row0:hover td,
#j-main-container table.adminlist tbody tr.row1:hover td { background-color: #ffd ; }
#j-main-container table.adminlist tbody tr td { height: 25px; background: #fff; border: 1px solid #fff; }
#j-main-container table.adminlist tbody tr.row1 td { background: #f9f9f9; border-top: 1px solid #FFF; }
#j-main-container table.adminlist tfoot tr { text-align: center; color: #333; }
#j-main-container table.adminlist tfoot td,
#j-main-container table.adminlist tfoot th { background-color: #f3f3f3; border-top: 1px solid #999; text-align: center; }
#j-main-container table.adminlist td.order { text-align: center; white-space: nowrap; }
#j-main-container table.adminlist td.order span { float: left; display: block; width: 20px; text-align: center; }
.j-sidebar-container.j-sidebar-hidden {
margin-left: 2vw !important;
}
#j-main-container .clear {clear:both;margin:0px;padding:0px;height:0px;width:0px;}
#j-main-container div.hasab {display:inline-block;width:340px;vertical-align:top;border:0px solid #000;}
#j-main-container div.hasab div.inputholder {display:block;height:38px;border:0px solid #ff0000;}
#j-main-container div.hasab div.inputholder label {display:inline-block;width:120px;font-weight:bold;border:0px solid #00ff00;}
#j-main-container div.hasab div.inputholder input[type="text"],
#j-main-container div.hasab div.inputholder select {display:inline;margin:0px;width:190px;}
#j-main-container div.hasab div.inputholder textarea {width:320px;height:260px;}
#j-main-container div.hasab div.inputholder input[type="file"] {width:190px;}
#j-main-container div.hasab div.inputholder fieldset {display:inline;width:190px;white-space:nowrap;border:0px solid #ff00ff;}
#j-main-container div.hasab div.inputholder fieldset label {width:50px;font-weight:normal;}
/* TableHelper */
div.tableholder table { border: 1px solid #dddddd; font-size: 11px; }
div.tableholder table thead, div.tableholder table tfoot { background-color: #ddd; }
div.tableholder table thead tr td { padding-left: 3px; border-bottom: 1px solid #dddddd; white-space:nowrap; vertical-align:middle; }
div.tableholder table tfoot tr td { padding-left: 3px; border-top: 1px solid #dddddd; white-space:nowrap; vertical-align:middle; }
div.tableholder table thead tr th,
div.tableholder table tfoot tr th { white-space:nowrap; vertical-align:middle; }
div.tableholder table thead tr th span { display: block; float: left; text-align: center; margin-left:3px; float: left; height: 30px; line-height: 14px; font-weight: bold; }
div.tableholder table thead tr th div.shortlinks { display: inline-block; margin: 1px; width: 9px; height: 24px; float: right; }
div.tableholder table thead tr th div.shortlinks a.tableshort-up { display: block; text-decoration: none; width: 9px; height: 11px; background: #ececec url(/administrator/components/com_alworkshops/assets/images/tableshort-up.jpg) no-repeat left top; }
div.tableholder table thead tr th div.shortlinks a.tableshort-up:hover { background: #ececec url(/administrator/components/com_alworkshops/assets/images/tableshort-up.jpg) no-repeat left -11px; }
div.tableholder table thead tr th div.shortlinks a.tableshort-down { margin-top:2px;display: block; text-decoration: none; width: 9px; height: 11px; background: #ececec url(/administrator/components/com_alworkshops/assets/images/tableshort-down.jpg) no-repeat left top; }
div.tableholder table thead tr th div.shortlinks a.tableshort-down:hover { margin-top:2px;background: #ececec url(/administrator/components/com_alworkshops/assets/images/tableshort-down.jpg) no-repeat left -11px; }
div.tableholder table tbody tr.even { background-color: #ebebeb; }
div.tableholder table tbody tr.odd { background-color: #ffffff; }
div.tableholder table tbody tr.selected { background-color: #f5c0b8;color:#000000; }
div.tableholder table tbody tr.selected a { color: #000000;}
div.tableholder table tbody tr td { padding: 3px; text-align: left; border-top: 0px solid #afc4d2; border-right: 1px solid #e0eef7; }
div.tableholder table tbody tr td img { padding: 0px; margin:0px; border:0px;vertical-align: middle; }
div.tableholder table tbody tr.even:hover,
div.tableholder table tbody tr.odd:hover,
div.tableholder table tbody tr.selected:hover { cursor: pointer; background-color: #c5e6a1; color: #000000; }
div.tableholder table tbody tr td input { padding: 0px; margin:0; vertical-align:middle; }
div.tableholder table tbody tr td img { margin: 0px 2px; }
div.tableholder table tfoot { height: 30px; font-size: 11px; font-weight: bold; }
div.tableholder table a {text-decoration:none;cursor:pointer;}
div.tableholder table a:hover {text-decoration:none;cursor:pointer;}
div.tablenav select { margin: 0px; float: left; width: auto; padding: 2px 2px 3px 2px;border: 1px solid #afc4d2;font-size: 11px;font-family: Tahoma;font-weight: normal;text-align: left;color: #484947;cursor: pointer;}
div.tablenav {margin: 10px 0px 10px 0px;height: 32px;overflow: hidden;}
div.tablenav p {margin: 0px 0px 0px 3px;float: left;line-height: 32px; float:left;}
div.tablenav ul.pager {margin: 0px 0px 0px 20px;float: right;height: 22px;}
div.tablenav ul.pager li {display: inline;}
div.tablenav ul.pager li a,
div.tablenav ul.pager li a.inactive,
div.tablenav ul.pager li a.inactive:hover { background: none; display: inline-block; float: left; margin: 0px 0px 0px 3px; width: 20px; height: 20px; line-height: 20px; font-size: 12px; font-weight: bold; text-align: center; vertical-align: middle; border: 1px solid #B3B9AA; color: #009cff; cursor:pointer;}
div.tablenav ul.pager li a.nextfive { border: none; line-height: 22px; cursor:pointer; }
div.tablenav ul.pager li a.inactive,
div.tablenav ul.pager li a.inactive:hover { color: #c3c4c1; cursor:pointer;}
div.tablenav ul.pager li a.activepage,
div.tablenav ul.pager li a.activepage:hover { background-color: #b4c799; color: #ffffff; border-color: #577046; font-weight: bold; cursor:pointer;}
div.tablenav ul.pager li a:hover {background-color: #009cff;color: #ffffff;border-color: #2d4e63; cursor:pointer; }
#preview {position:absolute; border:1px solid #ccc;display:none;color:#fff;background:#fff;padding:5px;white-space:normal; }
#j-sidebar-container {display:inline-block;vertical-align:top;width:14.5%;height:300px;border:0px solid #000000;}
#j-main-container {display:inline-block;vertical-align:top;width:85%;border:0px solid #000000;}
#j-main-container .pagination {margin:0px;padding:0px;display:inline;}
#j-main-container table.adminlist {width:100%;border-spacing:1px;background-color:#e7e7e7;color:#666;}
#j-main-container table.adminlist td,
#j-main-container table.adminlist th {padding:4px;}
#j-main-container table.adminlist thead th {text-align:center;background:#f0f0f0;color:#666;border-bottom:1px solid #999;border-left:1px solid #fff;}
#j-main-container table.adminlist thead a:hover { text-decoration: none; }
#j-main-container table.adminlist thead th img { vertical-align: middle; }
#j-main-container table.adminlist tbody th { font-weight: bold; }
#j-main-container table.adminlist tbody tr { background-color: #fff; text-align: left; }
#j-main-container table.adminlist tbody tr.row1 { background: #f9f9f9; border-top: 1px solid #fff; }
#j-main-container table.adminlist tbody tr.row0:hover td,
#j-main-container table.adminlist tbody tr.row1:hover td { background-color: #ffd ; }
#j-main-container table.adminlist tbody tr td { height: 25px; background: #fff; border: 1px solid #fff; }
#j-main-container table.adminlist tbody tr.row1 td { background: #f9f9f9; border-top: 1px solid #FFF; }
#j-main-container table.adminlist tfoot tr { text-align: center; color: #333; }
#j-main-container table.adminlist tfoot td,
#j-main-container table.adminlist tfoot th { background-color: #f3f3f3; border-top: 1px solid #999; text-align: center; }
#j-main-container table.adminlist td.order { text-align: center; white-space: nowrap; }
#j-main-container table.adminlist td.order span { float: left; display: block; width: 20px; text-align: center; }
.j-sidebar-container.j-sidebar-hidden {
margin-left: 2vw !important;
}
#j-main-container .clear {clear:both;margin:0px;padding:0px;height:0px;width:0px;}
#j-main-container div.hasab {display:inline-block;width:340px;vertical-align:top;border:0px solid #000;}
#j-main-container div.hasab div.inputholder {display:block;height:38px;border:0px solid #ff0000;}
#j-main-container div.hasab div.inputholder label {display:inline-block;width:120px;font-weight:bold;border:0px solid #00ff00;}
#j-main-container div.hasab div.inputholder input[type="text"],
#j-main-container div.hasab div.inputholder select {display:inline;margin:0px;width:190px;}
#j-main-container div.hasab div.inputholder textarea {width:320px;height:260px;}
#j-main-container div.hasab div.inputholder input[type="file"] {width:190px;}
#j-main-container div.hasab div.inputholder fieldset {display:inline;width:190px;white-space:nowrap;border:0px solid #ff00ff;}
#j-main-container div.hasab div.inputholder fieldset label {width:50px;font-weight:normal;}
/* TableHelper */
div.tableholder table { border: 1px solid #dddddd; font-size: 11px; }
div.tableholder table thead, div.tableholder table tfoot { background-color: #ddd; }
div.tableholder table thead tr td { padding-left: 3px; border-bottom: 1px solid #dddddd; white-space:nowrap; vertical-align:middle; }
div.tableholder table tfoot tr td { padding-left: 3px; border-top: 1px solid #dddddd; white-space:nowrap; vertical-align:middle; }
div.tableholder table thead tr th,
div.tableholder table tfoot tr th { white-space:nowrap; vertical-align:middle; }
div.tableholder table thead tr th span { display: block; float: left; text-align: center; margin-left:3px; float: left; height: 30px; line-height: 14px; font-weight: bold; }
div.tableholder table thead tr th div.shortlinks { display: inline-block; margin: 1px; width: 9px; height: 24px; float: right; }
div.tableholder table thead tr th div.shortlinks a.tableshort-up { display: block; text-decoration: none; width: 9px; height: 11px; background: #ececec url(/administrator/components/com_alworkshops/assets/images/tableshort-up.jpg) no-repeat left top; }
div.tableholder table thead tr th div.shortlinks a.tableshort-up:hover { background: #ececec url(/administrator/components/com_alworkshops/assets/images/tableshort-up.jpg) no-repeat left -11px; }
div.tableholder table thead tr th div.shortlinks a.tableshort-down { margin-top:2px;display: block; text-decoration: none; width: 9px; height: 11px; background: #ececec url(/administrator/components/com_alworkshops/assets/images/tableshort-down.jpg) no-repeat left top; }
div.tableholder table thead tr th div.shortlinks a.tableshort-down:hover { margin-top:2px;background: #ececec url(/administrator/components/com_alworkshops/assets/images/tableshort-down.jpg) no-repeat left -11px; }
div.tableholder table tbody tr.even { background-color: #ebebeb; }
div.tableholder table tbody tr.odd { background-color: #ffffff; }
div.tableholder table tbody tr.selected { background-color: #f5c0b8;color:#000000; }
div.tableholder table tbody tr.selected a { color: #000000;}
div.tableholder table tbody tr td { padding: 3px; text-align: left; border-top: 0px solid #afc4d2; border-right: 1px solid #e0eef7; }
div.tableholder table tbody tr td img { padding: 0px; margin:0px; border:0px;vertical-align: middle; }
div.tableholder table tbody tr.even:hover,
div.tableholder table tbody tr.odd:hover,
div.tableholder table tbody tr.selected:hover { cursor: pointer; background-color: #c5e6a1; color: #000000; }
div.tableholder table tbody tr td input { padding: 0px; margin:0; vertical-align:middle; }
div.tableholder table tbody tr td img { margin: 0px 2px; }
div.tableholder table tfoot { height: 30px; font-size: 11px; font-weight: bold; }
div.tableholder table a {text-decoration:none;cursor:pointer;}
div.tableholder table a:hover {text-decoration:none;cursor:pointer;}
div.tablenav select { margin: 0px; float: left; width: auto; padding: 2px 2px 3px 2px;border: 1px solid #afc4d2;font-size: 11px;font-family: Tahoma;font-weight: normal;text-align: left;color: #484947;cursor: pointer;}
div.tablenav {margin: 10px 0px 10px 0px;height: 32px;overflow: hidden;}
div.tablenav p {margin: 0px 0px 0px 3px;float: left;line-height: 32px; float:left;}
div.tablenav ul.pager {margin: 0px 0px 0px 20px;float: right;height: 22px;}
div.tablenav ul.pager li {display: inline;}
div.tablenav ul.pager li a,
div.tablenav ul.pager li a.inactive,
div.tablenav ul.pager li a.inactive:hover { background: none; display: inline-block; float: left; margin: 0px 0px 0px 3px; width: 20px; height: 20px; line-height: 20px; font-size: 12px; font-weight: bold; text-align: center; vertical-align: middle; border: 1px solid #B3B9AA; color: #009cff; cursor:pointer;}
div.tablenav ul.pager li a.nextfive { border: none; line-height: 22px; cursor:pointer; }
div.tablenav ul.pager li a.inactive,
div.tablenav ul.pager li a.inactive:hover { color: #c3c4c1; cursor:pointer;}
div.tablenav ul.pager li a.activepage,
div.tablenav ul.pager li a.activepage:hover { background-color: #b4c799; color: #ffffff; border-color: #577046; font-weight: bold; cursor:pointer;}
div.tablenav ul.pager li a:hover {background-color: #009cff;color: #ffffff;border-color: #2d4e63; cursor:pointer; }
#preview {position:absolute; border:1px solid #ccc;display:none;color:#fff;background:#fff;padding:5px;white-space:normal; }
#tooltip {position:absolute; border:1px solid #333;display:none;color:#333;background:#f7f5d1;padding:2px 5px; }

View File

@ -1,59 +1,59 @@
<?php
/**
* @version CVS: 1.0.0
* @package Com_Alworkshops
* @author Zsolt Fekete <mcleod78@gmail.com>
* @copyright 2017 Zsolt Fekete
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.controller'); // import Joomla controller library
$app = JFactory::getApplication();
$view = $app->input->get('view');
$option = $app->input->get('option');
$l = array(
array('COM_ALWORKSHOPS_CONTROL_PANEL_HELP', ''),
array('COM_ALWORKSHOPS_APPLICATIONS', 'application'),
array('COM_ALWORKSHOPS_COURSES', 'course'),
array('COM_ALWORKSHOPS_SESSIONS', 'session'),
array('COM_ALWORKSHOPS_SWITCH', 'switch'),
array('COM_ALWORKSHOPS_ONLINE_SESSIONS', 'onlinesession'),
array('COM_ALWORKSHOPS_EDUCATION', 'education')
);
foreach ($l as $v) {
JHtmlSidebar::addEntry(JText::_($v[0]), 'index.php?option=' . $option . ($v[1] == '' ? '' : '&view=') . $v[1], ($view == $v[1] || $view == $v[1] . "edit" ? true : false));
}
/**
* Class AlworkshopsController
*
* @since 1.6
*/
class AlworkshopsController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$view = JFactory::getApplication()->input->getCmd('view', '');
JFactory::getApplication()->input->set('view', $view);
parent::display($cachable, $urlparams);
return $this;
}
}
<?php
/**
* @version CVS: 1.0.0
* @package Com_Alworkshops
* @author Zsolt Fekete <mcleod78@gmail.com>
* @copyright 2017 Zsolt Fekete
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.controller'); // import Joomla controller library
$app = JFactory::getApplication();
$view = $app->input->get('view');
$option = $app->input->get('option');
$l = array(
array('COM_ALWORKSHOPS_CONTROL_PANEL_HELP', ''),
array('COM_ALWORKSHOPS_APPLICATIONS', 'application'),
array('COM_ALWORKSHOPS_COURSES', 'course'),
array('COM_ALWORKSHOPS_SESSIONS', 'session'),
array('COM_ALWORKSHOPS_SWITCH', 'switch'),
array('COM_ALWORKSHOPS_ONLINE_SESSIONS', 'onlinesession'),
array('COM_ALWORKSHOPS_EDUCATION', 'education')
);
foreach ($l as $v) {
JHtmlSidebar::addEntry(JText::_($v[0]), 'index.php?option=' . $option . ($v[1] == '' ? '' : '&view=') . $v[1], ($view == $v[1] || $view == $v[1] . "edit" ? true : false));
}
/**
* Class AlworkshopsController
*
* @since 1.6
*/
class AlworkshopsController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$view = JFactory::getApplication()->input->getCmd('view', '');
JFactory::getApplication()->input->set('view', $view);
parent::display($cachable, $urlparams);
return $this;
}
}

View File

@ -1,104 +1,104 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem');
define('TABLE','`alworkshops_courses`');
class AlworkshopsModelCourseEdit extends JModelList
{
protected $item;
protected $lang;
public function getItem($id="")
{
$db=JFactory::getDBO();
$db->setQuery("SELECT c.*,s.kurzus FROM ".TABLE." c LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias WHERE c.id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function saveItem($item=NULL,$id=NULL)
{
if (is_array($item))
{
$db=JFactory::getDbo();
$query=$db->getQuery(true);
$values=array();
if ($id)
{
foreach ($item as $k=>$v) $values[]=$db->quoteName($k)."=".$db->quote($v);
$query->update(TABLE)->set($values)->where(array('`id`='.(int)$id));
$db->setQuery($query);
$result=$db->execute();
}
else
{
foreach ($item as $v) $values[]=$db->quote($v);
$query->insert(TABLE)->columns($db->quoteName(array_keys($item)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$result=$db->insertid();
}
return ($result);
}
else
{
return (FALSE);
}
}
public function getTemplates()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM #__categories WHERE alias='workshop-email-templates' LIMIT 1;");
$result=$db->loadObjectList();
if (count($result))
{
$db->setQuery("SELECT id,title FROM #__content WHERE catid=".$result[0]->id." AND state=1;");
$ret=$db->loadObjectList();
}
return ($ret);
}
public function getAliases()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("SELECT `alias`,`kurzus` FROM alworkshops_switch WHERE `lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."' ORDER BY kurzus,alias;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getSwitch($alias='')
{
$ret=array();
if (trim($alias)=="") return ($ret);
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM `alworkshops_switch` WHERE `alias`='".trim($alias)."' LIMIT 1;");
$ret=$db->loadObjectList();
return (count($ret) ? $ret[0] : array());
}
public function getTitles()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(c.`title`) AS `title`,s.`kurzus`
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY s.`kurzus`,c.`title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=JFactory::getLanguage()->getTag(); }
return $this->lang;
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem');
define('TABLE','`alworkshops_courses`');
class AlworkshopsModelCourseEdit extends JModelList
{
protected $item;
protected $lang;
public function getItem($id="")
{
$db=JFactory::getDBO();
$db->setQuery("SELECT c.*,s.kurzus FROM ".TABLE." c LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias WHERE c.id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function saveItem($item=NULL,$id=NULL)
{
if (is_array($item))
{
$db=JFactory::getDbo();
$query=$db->getQuery(true);
$values=array();
if ($id)
{
foreach ($item as $k=>$v) $values[]=$db->quoteName($k)."=".$db->quote($v);
$query->update(TABLE)->set($values)->where(array('`id`='.(int)$id));
$db->setQuery($query);
$result=$db->execute();
}
else
{
foreach ($item as $v) $values[]=$db->quote($v);
$query->insert(TABLE)->columns($db->quoteName(array_keys($item)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$result=$db->insertid();
}
return ($result);
}
else
{
return (FALSE);
}
}
public function getTemplates()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM #__categories WHERE alias='workshop-email-templates' LIMIT 1;");
$result=$db->loadObjectList();
if (count($result))
{
$db->setQuery("SELECT id,title FROM #__content WHERE catid=".$result[0]->id." AND state=1;");
$ret=$db->loadObjectList();
}
return ($ret);
}
public function getAliases()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("SELECT `alias`,`kurzus` FROM alworkshops_switch WHERE `lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."' ORDER BY kurzus,alias;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getSwitch($alias='')
{
$ret=array();
if (trim($alias)=="") return ($ret);
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM `alworkshops_switch` WHERE `alias`='".trim($alias)."' LIMIT 1;");
$ret=$db->loadObjectList();
return (count($ret) ? $ret[0] : array());
}
public function getTitles()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(c.`title`) AS `title`,s.`kurzus`
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY s.`kurzus`,c.`title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=JFactory::getLanguage()->getTag(); }
return $this->lang;
}
}

View File

@ -1,99 +1,99 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem');
class AlworkshopsModelEducationEdit extends JModelList
{
protected $item;
protected $lang;
public function getItem($id = "")
{
$db = JFactory::getDBO();
$db->setQuery("SELECT * FROM www_archline_hu.aleducation_courses WHERE id = {$id} LIMIT 1;");
$result = $db->loadObjectList();
return (count($result) ? $result[0] : FALSE);
}
public function saveItem($item = NULL, $id = NULL)
{
if (!is_array($item))
return false;
$files = array();
$education = array();
foreach ($item['courses'] as $key => $value) {
$c_id = strtolower(str_replace(' ', '-', $value));
$c_id = str_replace('&', '-', $c_id);
$c_id = str_replace('---', '-', $c_id);
$c_id = str_replace('--', '-', $c_id);
$education[$c_id]['name'] = $value;
$education[$c_id]['lessons'] = $item['lessons'][$key];
}
$encoded = json_encode($education, JSON_UNESCAPED_UNICODE);
$json = '{"courses":' . $encoded . '}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$url = JFactory::getLanguage()->getTag() == 'hu-HU' ? "beiratkozas/tanfolyamok/" : "enrollments/courses/";
$url .= strtolower(str_replace(' ', '-', $item['title']));
$url = str_replace('&', '-', $url);
$url = str_replace('---', '-', $url);
$url = str_replace('--', '-', $url);
$fileJson = '';
if ($item['fileNames'][0] != '' && $item['fileLinks'][0] != '' && $item['articleID'][0] != '') {
$files['name'] = $item['fileNames'];
$files['link'] = $item['fileLinks'];
$files['article'] = $item['articleID'];
$fileJson = '{"files":' . json_encode($files, JSON_UNESCAPED_UNICODE) . '}';
}
$tomb = array(
'title' => $item['title'],
'lessons' => $json,
'published' => $item['published'],
'url' => $url,
'fileDownloadLink' => $fileJson,
'lang' => JFactory::getLanguage()->getTag() == 'hu-HU' ? "hun" : "eng",
'overviewID' => $item['overviewID']
);
if ($item['thumbnail'] != '')
$tomb['image'] = $item['thumbnail'];
if ($id) {
foreach ($tomb as $k => $v)
$values[] = $db->quoteName($k) . "=" . $db->quote($v);
$query->update('`www_archline_hu`.`aleducation_courses`')->set($values)->where(array('`id`=' . (int)$id));
$db->setQuery($query);
$result = $db->execute();
} else {
foreach ($tomb as $v)
$values[] = $db->quote($v);
$query->insert('`www_archline_hu`.`aleducation_courses`')->columns($db->quoteName(array_keys($tomb)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$result = $db->insertid();
}
return $result;
}
public function getLang()
{
if (!isset($this->lang)) {
$this->lang = JFactory::getLanguage()->getTag();
}
return $this->lang;
}
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem');
class AlworkshopsModelEducationEdit extends JModelList
{
protected $item;
protected $lang;
public function getItem($id = "")
{
$db = JFactory::getDBO();
$db->setQuery("SELECT * FROM www_archline_hu.aleducation_courses WHERE id = {$id} LIMIT 1;");
$result = $db->loadObjectList();
return (count($result) ? $result[0] : FALSE);
}
public function saveItem($item = NULL, $id = NULL)
{
if (!is_array($item))
return false;
$files = array();
$education = array();
foreach ($item['courses'] as $key => $value) {
$c_id = strtolower(str_replace(' ', '-', $value));
$c_id = str_replace('&', '-', $c_id);
$c_id = str_replace('---', '-', $c_id);
$c_id = str_replace('--', '-', $c_id);
$education[$c_id]['name'] = $value;
$education[$c_id]['lessons'] = $item['lessons'][$key];
}
$encoded = json_encode($education, JSON_UNESCAPED_UNICODE);
$json = '{"courses":' . $encoded . '}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$url = JFactory::getLanguage()->getTag() == 'hu-HU' ? "beiratkozas/tanfolyamok/" : "enrollments/courses/";
$url .= strtolower(str_replace(' ', '-', $item['title']));
$url = str_replace('&', '-', $url);
$url = str_replace('---', '-', $url);
$url = str_replace('--', '-', $url);
$fileJson = '';
if ($item['fileNames'][0] != '' && $item['fileLinks'][0] != '' && $item['articleID'][0] != '') {
$files['name'] = $item['fileNames'];
$files['link'] = $item['fileLinks'];
$files['article'] = $item['articleID'];
$fileJson = '{"files":' . json_encode($files, JSON_UNESCAPED_UNICODE) . '}';
}
$tomb = array(
'title' => $item['title'],
'lessons' => $json,
'published' => $item['published'],
'url' => $url,
'fileDownloadLink' => $fileJson,
'lang' => JFactory::getLanguage()->getTag() == 'hu-HU' ? "hun" : "eng",
'overviewID' => $item['overviewID']
);
if ($item['thumbnail'] != '')
$tomb['image'] = $item['thumbnail'];
if ($id) {
foreach ($tomb as $k => $v)
$values[] = $db->quoteName($k) . "=" . $db->quote($v);
$query->update('`www_archline_hu`.`aleducation_courses`')->set($values)->where(array('`id`=' . (int)$id));
$db->setQuery($query);
$result = $db->execute();
} else {
foreach ($tomb as $v)
$values[] = $db->quote($v);
$query->insert('`www_archline_hu`.`aleducation_courses`')->columns($db->quoteName(array_keys($tomb)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$result = $db->insertid();
}
return $result;
}
public function getLang()
{
if (!isset($this->lang)) {
$this->lang = JFactory::getLanguage()->getTag();
}
return $this->lang;
}
}

View File

@ -1,118 +1,118 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem');
define('TABLE','`alworkshops_online_sessions`');
class AlworkshopsModelOnlineSessionEdit extends JModelList
{
protected $item;
protected $lang;
public function getItem($id="")
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM ".TABLE." WHERE id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function getSwitch($id=0)
{
if ((int)$id==0) return (FALSE);
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM `alworkshops_switch` WHERE id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function saveItem($item=NULL,$id=NULL)
{
if (is_array($item))
{
/*$switch=$this->getSwitch($item['switchid']);
$item['description']=$switch->title;*/
$values=array();
$db=JFactory::getDbo();
$query=$db->getQuery(true);
if ($id)
{
foreach ($item as $k=>$v) $values[]=$db->quoteName($k)."=".$db->quote($v);
$query->update(TABLE)->set($values)->where(array('`id`='.(int)$id));
$db->setQuery($query);
$result=$db->execute();
}
else
{
foreach ($item as $v) $values[]=$db->quote($v);
$query->insert(TABLE)->columns($db->quoteName(array_keys($item)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$result=$db->insertid();
}
return ($result);
}
else
{
return (FALSE);
}
}
public function getCourses()
{
$ret=array();
$db=JFactory::getDBO();
$webinar = "";
if($this->getLang() == 'hu-HU') {
$webinar = "webinariumok";
} else {
$webinar = "webinars";
}
$db->setQuery("
SELECT c.*
FROM alworkshops_courses c
WHERE c.alias = '{$webinar}'
ORDER BY c.id DESC;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getTitles()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(c.`title`) AS `title`
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.kurzus='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY `title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getDescriptions()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(c.`title`) AS `title`,s.id AS switchid
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.workshop='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY `title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=JFactory::getLanguage()->getTag(); }
return $this->lang;
}
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem');
define('TABLE','`alworkshops_online_sessions`');
class AlworkshopsModelOnlineSessionEdit extends JModelList
{
protected $item;
protected $lang;
public function getItem($id="")
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM ".TABLE." WHERE id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function getSwitch($id=0)
{
if ((int)$id==0) return (FALSE);
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM `alworkshops_switch` WHERE id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function saveItem($item=NULL,$id=NULL)
{
if (is_array($item))
{
/*$switch=$this->getSwitch($item['switchid']);
$item['description']=$switch->title;*/
$values=array();
$db=JFactory::getDbo();
$query=$db->getQuery(true);
if ($id)
{
foreach ($item as $k=>$v) $values[]=$db->quoteName($k)."=".$db->quote($v);
$query->update(TABLE)->set($values)->where(array('`id`='.(int)$id));
$db->setQuery($query);
$result=$db->execute();
}
else
{
foreach ($item as $v) $values[]=$db->quote($v);
$query->insert(TABLE)->columns($db->quoteName(array_keys($item)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$result=$db->insertid();
}
return ($result);
}
else
{
return (FALSE);
}
}
public function getCourses()
{
$ret=array();
$db=JFactory::getDBO();
$webinar = "";
if($this->getLang() == 'hu-HU') {
$webinar = "webinariumok";
} else {
$webinar = "webinars";
}
$db->setQuery("
SELECT c.*
FROM alworkshops_courses c
WHERE c.alias = '{$webinar}'
ORDER BY c.id DESC;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getTitles()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(c.`title`) AS `title`
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.kurzus='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY `title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getDescriptions()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(c.`title`) AS `title`,s.id AS switchid
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.workshop='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY `title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=JFactory::getLanguage()->getTag(); }
return $this->lang;
}
}

View File

@ -1,112 +1,112 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem');
define('TABLE','`alworkshops_sessions`');
class AlworkshopsModelSessionEdit extends JModelList
{
protected $item;
protected $lang;
public function getItem($id="")
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM ".TABLE." WHERE id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function getSwitch($id=0)
{
if ((int)$id==0) return (FALSE);
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM `alworkshops_switch` WHERE id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function saveItem($item=NULL,$id=NULL)
{
if (is_array($item))
{
$switch=$this->getSwitch($item['switchid']);
$item['description']=$switch->title;
$values=array();
$db=JFactory::getDbo();
$query=$db->getQuery(true);
if ($id)
{
foreach ($item as $k=>$v) $values[]=$db->quoteName($k)."=".$db->quote($v);
$query->update(TABLE)->set($values)->where(array('`id`='.(int)$id));
$db->setQuery($query);
$result=$db->execute();
}
else
{
foreach ($item as $v) $values[]=$db->quote($v);
$query->insert(TABLE)->columns($db->quoteName(array_keys($item)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$result=$db->insertid();
}
return ($result);
}
else
{
return (FALSE);
}
}
public function getCourses()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT c.*
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.kurzus='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY c.`id` DESC;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getTitles()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(c.`title`) AS `title`
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.kurzus='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY `title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getDescriptions()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(s.`title`) AS `title`,s.id AS switchid
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.workshop='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY `title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=JFactory::getLanguage()->getTag(); }
return $this->lang;
}
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem');
define('TABLE','`alworkshops_sessions`');
class AlworkshopsModelSessionEdit extends JModelList
{
protected $item;
protected $lang;
public function getItem($id="")
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM ".TABLE." WHERE id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function getSwitch($id=0)
{
if ((int)$id==0) return (FALSE);
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM `alworkshops_switch` WHERE id=".(int)$id." LIMIT 1;");
$result=$db->loadObjectList();
return(count($result) ? $result[0] : FALSE);
}
public function saveItem($item=NULL,$id=NULL)
{
if (is_array($item))
{
$switch=$this->getSwitch($item['switchid']);
$item['description']=$switch->title;
$values=array();
$db=JFactory::getDbo();
$query=$db->getQuery(true);
if ($id)
{
foreach ($item as $k=>$v) $values[]=$db->quoteName($k)."=".$db->quote($v);
$query->update(TABLE)->set($values)->where(array('`id`='.(int)$id));
$db->setQuery($query);
$result=$db->execute();
}
else
{
foreach ($item as $v) $values[]=$db->quote($v);
$query->insert(TABLE)->columns($db->quoteName(array_keys($item)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$result=$db->insertid();
}
return ($result);
}
else
{
return (FALSE);
}
}
public function getCourses()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT c.*
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.kurzus='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY c.`id` DESC;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getTitles()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(c.`title`) AS `title`
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.kurzus='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY `title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getDescriptions()
{
$ret=array();
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(s.`title`) AS `title`,s.id AS switchid
FROM alworkshops_courses c
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE s.workshop='Y' AND s.`lang`='".($this->getLang()=='hu-HU' ? 'hun' : 'eng')."'
ORDER BY `title`;");
$ret=$db->loadObjectList();
return ($ret);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=JFactory::getLanguage()->getTag(); }
return $this->lang;
}
}

View File

@ -1,221 +1,221 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
JHtml::_('behavior.tooltip');
?>
<div id="j-sidebar-container"><?=JHtmlSidebar::render()?></div>
<div id="j-main-container">
<h2><?=($this->item->kurzus=='Y' ? JText::_('COM_ALWORKSHOPS_COURSE') : JText::_('COM_ALWORKSHOPS_WORKSHOP'))?></h2>
<form method="post" enctype="multipart/form-data">
<div class="hasab">
<div class="inputholder">
<label for="wid"><?=JText::_('COM_ALWORKSHOPS_ID')?>:</label>
<input type="text" name="wid" id="wid" value="<?=($this->item ? $this->item->id : 0)?>" maxlength="15" readonly="readonly" />
</div>
<div class="inputholder">
<label for="title"><?=JText::_('COM_ALWORKSHOPS_TITLE')?>:</label>
<span id="title">
<select name="title">
<?php foreach($this->titles as $idx=>$title) : ?>
<?php if ($idx>0 && $this->titles[$idx-1]->kurzus!=$this->titles[$idx]->kurzus):?>
<option disabled="disabled">---</option>
<?php endif;?>
<option value="<?=$title->title?>" <?=($this->item->title==$title->title ? 'selected="selected"' : "")?>><?=$title->title?></option>
<?php endforeach;?>
</select>
</span>
<span id="title_text" style="display:none"><input type="text" name="title_new" title="Add new" style="width:176px;"/></span>
<input type="checkbox" onclick="javascript:switchController('title','title_text')" />
</div>
<div class="inputholder">
<label for="alias"><?=JText::_('COM_ALWORKSHOPS_ALIAS')?>:</label>
<span id="alias">
<select name="alias">
<?php foreach($this->aliases as $idx=>$alias) : ?>
<?php if ($idx>0 && $this->aliases[$idx-1]->kurzus!=$this->aliases[$idx]->kurzus):?>
<option disabled="disabled">---</option>
<?php endif;?>
<option value="<?=$alias->alias?>" <?=($this->item->alias==$alias->alias ? 'selected="selected"' : "")?>><?=$alias->alias?></option>
<?php endforeach;?>
</select>
</span>
<!--span id="alias_text" style="display:none"><input type="text" name="alias" title="Add new" style="width:176px;"/></span>
<input type="checkbox" onclick="javascript:switchController('alias','alias_text')" /-->
</div>
<div class="inputholder">
<label for="price"><?=JText::_('COM_ALWORKSHOPS_PRICE')?>:</label>
<input type="text" name="price" id="price" value="<?=($this->item ? $this->item->price : 0)?>" maxlength="15" />
</div>
<div class="inputholder">
<label for="vat"><?=JText::_('COM_ALWORKSHOPS_VAT')?>:</label>
<input type="text" name="vat" id="vat" value="<?=($this->item ? $this->item->vat : 0)?>" maxlength="2" />
</div>
<div class="inputholder">
<label for="course_info">Info:</label>
<input type="text" name="course_info" id="course_info" value="<?=($this->item ? $this->item->course_info : "")?>" maxlength="100" />
</div>
<div class="inputholder">
<label for="external_link">External link:</label>
<input type="text" name="external_link" id="external_link" value="<?=($this->item ? $this->item->external_link : "")?>" maxlength="100" />
</div>
<div class="inputholder">
<label for="thumbnail">Thumbnail:</label>
<input type="file" name="thumbnail" id="thumbnail">
</div>
<div class="inputholder">
<a href="<?=($this->item ? $this->item->thumbnail : "")?>" target="_blank"><?=($this->item ? $this->item->thumbnail : "")?></a>
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="min_attend"><?=JText::_('COM_ALWORKSHOPS_MIN_ATTEND')?>:</label>
<input type="text" name="min_attend" id="min_attend" value="<?=($this->item ? $this->item->min_attend : 0)?>" maxlength="3" />
</div>
<div class="inputholder">
<label for="capacity"><?=JText::_('COM_ALWORKSHOPS_CAPACITY')?>:</label>
<input type="text" name="capacity" id="capacity" value="<?=($this->item ? $this->item->capacity : 0)?>" maxlength="3" />
</div>
<div class="inputholder">
<label for="location"><?=JText::_('COM_ALWORKSHOPS_LOCATION')?>:</label>
<input type="text" name="location" id="location" value="<?=($this->item ? $this->item->location : "")?>" maxlength="100" />
</div>
<div class="inputholder">
<label for="email_template"><?=JText::_('COM_ALWORKSHOPS_EMAIL_TEMPLATE')?>:</label>
<select name="email_template" id="email_template">
<?php foreach ($this->templates as $template) :?>
<option value="<?=$template->id?>" <?=($this->item && $template->id==$this->item->email_template ? 'selected="selected"' : '')?>><?=$template->title?></option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="course_level">Course level:</label>
<select name="course_level" id="course_level">
<option value="0" <?=($this->item && $this->item->course_level == 0 ? 'selected="selected"' : '')?>>Nem</option>
<option value="1" <?=($this->item && $this->item->course_level == 1 ? 'selected="selected"' : '')?>>Alapfokú tanfolyam</option>
<option value="2" <?=($this->item && $this->item->course_level == 2 ? 'selected="selected"' : '')?>>Középfokú tanfolyam</option>
<option value="3" <?=($this->item && $this->item->course_level == 3 ? 'selected="selected"' : '')?>>Felsőfokú tanfolyam</option>
</select>
</div>
<div class="inputholder">
<label for="course_name">Topic:</label>
<input type="text" name="course_name" id="course_name" value="<?=($this->item ? $this->item->course_name : "")?>" maxlength="100" />
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="start_date"><?=JText::_('COM_ALWORKSHOPS_START_DATE')?>:</label>
<input type="text" name="start_date" id="start_date" value="<?=($this->item ? $this->item->start_date : "")?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="start_time"><?=JText::_('COM_ALWORKSHOPS_START_TIME')?>:</label>
<input type="text" name="start_time" id="start_time" value="<?=($this->item ? $this->item->start_time : "")?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="finish_date"><?=JText::_('COM_ALWORKSHOPS_FINISH_DATE')?>:</label>
<input type="text" name="finish_date" id="finish_date" value="<?=($this->item ? $this->item->finish_date : "")?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="finish_time"><?=JText::_('COM_ALWORKSHOPS_FINISH_TIME')?>:</label>
<input type="text" name="finish_time" id="finish_time" value="<?=($this->item ? $this->item->finish_time : "")?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="published"><?=JText::_('COM_ALWORKSHOPS_PUBLISHED')?>:</label>
<fieldset>
<input type="radio" name="published" id="published_y" value="Y" <?=($this->item && $this->item->published==='Y' ? 'checked="checked"' : '')?> /><label for="published_y"><?=JText::_('COM_ALWORKSHOPS_YES')?></label>
<input type="radio" name="published" id="published_n" value="N" <?=(!$this->item || $this->item->published==='N' || trim($this->item->published)=='' ? 'checked="checked"' : '')?> /><label for="published_n"><?=JText::_('COM_ALWORKSHOPS_NO')?></label>
</fieldset>
</div>
<div class="inputholder">
<label for="yt_link">YouTube Link:</label>
<input type="text" name="yt_link" id="yt_link" value="<?=($this->item ? $this->item->yt_link : "")?>" maxlength="100" />
</div>
</div>
<div class="clear"></div>
<?php if (isset($this->switch->comment) && $this->switch->comment==='Y') : ?>
<div class="inputholder">
<label for="comment"><strong><?=JText::_('COM_ALWORKSHOPS_COMMENT')?></strong>:</label>
<?=$this->editor->display('comment',$this->item->comment,'100%','150','50','15',false)?><br /><br />
</div>
<div class="clear"></div>
<?php endif;?>
<div class="hasab">
<div class="inputholder">
<input type="submit" name="save" id="save" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?>" />
<input type="submit" name="savenew" id="savenew" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?> & <?=JText::_('COM_ALWORKSHOPS_NEW')?>" />
<input type="submit" name="saveexit" id="saveexit" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?> & <?=JText::_('COM_ALWORKSHOPS_EXIT')?>" />
<input type="button" name="exit" id="exit" value="<?=JText::_('COM_ALWORKSHOPS_EXIT')?>" onclick="document.location.href='index.php?option=<?=JFactory::getApplication()->input->get('option')?>&view=<?=substr(JFactory::getApplication()->input->get('view'),0,-4)?>';" />
<input type="reset" name="reset" id="reset" value="<?=JText::_('COM_ALWORKSHOPS_RESET')?>" />
</div>
</div>
</form>
<div class="clear"></div>
<?php if ($this->item->kurzus=='Y') :?>
<h2><?=JText::_('COM_ALWORKSHOPS_SESSIONS')?></h2>
<form id="SessionController" action="/administrator/components/com_alworkshops/assets/ajax/AjaxSessionController.class.php" method="post" onsubmit="return submitForm('SessionController','tablediv2');">
<input type="hidden" name="title" value="" />
<input type="hidden" name="sid" value="" />
<input type="hidden" name="wid" value="<?=($this->item ? $this->item->id : 0)?>" />
<input type="hidden" name="description" value="" />
<input type="hidden" name="published" value="A" />
<input type="hidden" name="start_date" value="" />
<input type="hidden" name="finish_date" value="" />
<input type="hidden" name="refresh" value="" />
<input type="hidden" name="nojs" value="nojs" />
<input type="hidden" name="targetdiv" value="tablediv2" />
<div id="tablediv2"></div>
</form>
<?php endif; ?>
<h2><?=JText::_('COM_ALWORKSHOPS_APPLICATIONS')?></h2>
<form id="ApplicationController" action="/administrator/components/com_alworkshops/assets/ajax/AjaxApplicationController.class.php" method="post" onsubmit="return submitForm('ApplicationController','tablediv');">
<input type="hidden" name="title" id="title" value="" />
<input type="hidden" name="wid" id="wid" value="<?=($this->item ? $this->item->id : 0)?>" />
<input type="hidden" name="published" id="published" value="A" />
<input type="hidden" name="name" id="name" value="" />
<input type="hidden" name="uid" id="uid" value="" />
<input type="hidden" name="email" id="email" value="" />
<input type="hidden" name="start_date" value="" />
<input type="hidden" name="finish_date" value="" />
<input type="hidden" name="refresh" value="" />
<input type="hidden" name="nojs" value="nojs" />
<input type="hidden" name="targetdiv" value="tablediv" />
<div id="tablediv"></div>
</form>
</div>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#start_date").datepicker({dateFormat: "yy-mm-dd"});
jQuery("#finish_date").datepicker({dateFormat: "yy-mm-dd"});
submitForm('ApplicationController','tablediv');
<?php if ($this->item->kurzus=='Y') :?>
submitForm('SessionController','tablediv2');
<?php endif; ?>
});
function switchController(sel,txt)
{
jQuery("#"+sel).toggle();
jQuery("#"+txt).toggle();
}
</script>
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
JHtml::_('behavior.tooltip');
?>
<div id="j-sidebar-container"><?=JHtmlSidebar::render()?></div>
<div id="j-main-container">
<h2><?=($this->item->kurzus=='Y' ? JText::_('COM_ALWORKSHOPS_COURSE') : JText::_('COM_ALWORKSHOPS_WORKSHOP'))?></h2>
<form method="post" enctype="multipart/form-data">
<div class="hasab">
<div class="inputholder">
<label for="wid"><?=JText::_('COM_ALWORKSHOPS_ID')?>:</label>
<input type="text" name="wid" id="wid" value="<?=($this->item ? $this->item->id : 0)?>" maxlength="15" readonly="readonly" />
</div>
<div class="inputholder">
<label for="title"><?=JText::_('COM_ALWORKSHOPS_TITLE')?>:</label>
<span id="title">
<select name="title">
<?php foreach($this->titles as $idx=>$title) : ?>
<?php if ($idx>0 && $this->titles[$idx-1]->kurzus!=$this->titles[$idx]->kurzus):?>
<option disabled="disabled">---</option>
<?php endif;?>
<option value="<?=$title->title?>" <?=($this->item->title==$title->title ? 'selected="selected"' : "")?>><?=$title->title?></option>
<?php endforeach;?>
</select>
</span>
<span id="title_text" style="display:none"><input type="text" name="title_new" title="Add new" style="width:176px;"/></span>
<input type="checkbox" onclick="javascript:switchController('title','title_text')" />
</div>
<div class="inputholder">
<label for="alias"><?=JText::_('COM_ALWORKSHOPS_ALIAS')?>:</label>
<span id="alias">
<select name="alias">
<?php foreach($this->aliases as $idx=>$alias) : ?>
<?php if ($idx>0 && $this->aliases[$idx-1]->kurzus!=$this->aliases[$idx]->kurzus):?>
<option disabled="disabled">---</option>
<?php endif;?>
<option value="<?=$alias->alias?>" <?=($this->item->alias==$alias->alias ? 'selected="selected"' : "")?>><?=$alias->alias?></option>
<?php endforeach;?>
</select>
</span>
<!--span id="alias_text" style="display:none"><input type="text" name="alias" title="Add new" style="width:176px;"/></span>
<input type="checkbox" onclick="javascript:switchController('alias','alias_text')" /-->
</div>
<div class="inputholder">
<label for="price"><?=JText::_('COM_ALWORKSHOPS_PRICE')?>:</label>
<input type="text" name="price" id="price" value="<?=($this->item ? $this->item->price : 0)?>" maxlength="15" />
</div>
<div class="inputholder">
<label for="vat"><?=JText::_('COM_ALWORKSHOPS_VAT')?>:</label>
<input type="text" name="vat" id="vat" value="<?=($this->item ? $this->item->vat : 0)?>" maxlength="2" />
</div>
<div class="inputholder">
<label for="course_info">Info:</label>
<input type="text" name="course_info" id="course_info" value="<?=($this->item ? $this->item->course_info : "")?>" maxlength="100" />
</div>
<div class="inputholder">
<label for="external_link">External link:</label>
<input type="text" name="external_link" id="external_link" value="<?=($this->item ? $this->item->external_link : "")?>" maxlength="100" />
</div>
<div class="inputholder">
<label for="thumbnail">Thumbnail:</label>
<input type="file" name="thumbnail" id="thumbnail">
</div>
<div class="inputholder">
<a href="<?=($this->item ? $this->item->thumbnail : "")?>" target="_blank"><?=($this->item ? $this->item->thumbnail : "")?></a>
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="min_attend"><?=JText::_('COM_ALWORKSHOPS_MIN_ATTEND')?>:</label>
<input type="text" name="min_attend" id="min_attend" value="<?=($this->item ? $this->item->min_attend : 0)?>" maxlength="3" />
</div>
<div class="inputholder">
<label for="capacity"><?=JText::_('COM_ALWORKSHOPS_CAPACITY')?>:</label>
<input type="text" name="capacity" id="capacity" value="<?=($this->item ? $this->item->capacity : 0)?>" maxlength="3" />
</div>
<div class="inputholder">
<label for="location"><?=JText::_('COM_ALWORKSHOPS_LOCATION')?>:</label>
<input type="text" name="location" id="location" value="<?=($this->item ? $this->item->location : "")?>" maxlength="100" />
</div>
<div class="inputholder">
<label for="email_template"><?=JText::_('COM_ALWORKSHOPS_EMAIL_TEMPLATE')?>:</label>
<select name="email_template" id="email_template">
<?php foreach ($this->templates as $template) :?>
<option value="<?=$template->id?>" <?=($this->item && $template->id==$this->item->email_template ? 'selected="selected"' : '')?>><?=$template->title?></option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="course_level">Course level:</label>
<select name="course_level" id="course_level">
<option value="0" <?=($this->item && $this->item->course_level == 0 ? 'selected="selected"' : '')?>>Nem</option>
<option value="1" <?=($this->item && $this->item->course_level == 1 ? 'selected="selected"' : '')?>>Alapfokú tanfolyam</option>
<option value="2" <?=($this->item && $this->item->course_level == 2 ? 'selected="selected"' : '')?>>Középfokú tanfolyam</option>
<option value="3" <?=($this->item && $this->item->course_level == 3 ? 'selected="selected"' : '')?>>Felsőfokú tanfolyam</option>
</select>
</div>
<div class="inputholder">
<label for="course_name">Topic:</label>
<input type="text" name="course_name" id="course_name" value="<?=($this->item ? $this->item->course_name : "")?>" maxlength="100" />
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="start_date"><?=JText::_('COM_ALWORKSHOPS_START_DATE')?>:</label>
<input type="text" name="start_date" id="start_date" value="<?=($this->item ? $this->item->start_date : "")?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="start_time"><?=JText::_('COM_ALWORKSHOPS_START_TIME')?>:</label>
<input type="text" name="start_time" id="start_time" value="<?=($this->item ? $this->item->start_time : "")?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="finish_date"><?=JText::_('COM_ALWORKSHOPS_FINISH_DATE')?>:</label>
<input type="text" name="finish_date" id="finish_date" value="<?=($this->item ? $this->item->finish_date : "")?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="finish_time"><?=JText::_('COM_ALWORKSHOPS_FINISH_TIME')?>:</label>
<input type="text" name="finish_time" id="finish_time" value="<?=($this->item ? $this->item->finish_time : "")?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="published"><?=JText::_('COM_ALWORKSHOPS_PUBLISHED')?>:</label>
<fieldset>
<input type="radio" name="published" id="published_y" value="Y" <?=($this->item && $this->item->published==='Y' ? 'checked="checked"' : '')?> /><label for="published_y"><?=JText::_('COM_ALWORKSHOPS_YES')?></label>
<input type="radio" name="published" id="published_n" value="N" <?=(!$this->item || $this->item->published==='N' || trim($this->item->published)=='' ? 'checked="checked"' : '')?> /><label for="published_n"><?=JText::_('COM_ALWORKSHOPS_NO')?></label>
</fieldset>
</div>
<div class="inputholder">
<label for="yt_link">YouTube Link:</label>
<input type="text" name="yt_link" id="yt_link" value="<?=($this->item ? $this->item->yt_link : "")?>" maxlength="100" />
</div>
</div>
<div class="clear"></div>
<?php if (isset($this->switch->comment) && $this->switch->comment==='Y') : ?>
<div class="inputholder">
<label for="comment"><strong><?=JText::_('COM_ALWORKSHOPS_COMMENT')?></strong>:</label>
<?=$this->editor->display('comment',$this->item->comment,'100%','150','50','15',false)?><br /><br />
</div>
<div class="clear"></div>
<?php endif;?>
<div class="hasab">
<div class="inputholder">
<input type="submit" name="save" id="save" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?>" />
<input type="submit" name="savenew" id="savenew" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?> & <?=JText::_('COM_ALWORKSHOPS_NEW')?>" />
<input type="submit" name="saveexit" id="saveexit" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?> & <?=JText::_('COM_ALWORKSHOPS_EXIT')?>" />
<input type="button" name="exit" id="exit" value="<?=JText::_('COM_ALWORKSHOPS_EXIT')?>" onclick="document.location.href='index.php?option=<?=JFactory::getApplication()->input->get('option')?>&view=<?=substr(JFactory::getApplication()->input->get('view'),0,-4)?>';" />
<input type="reset" name="reset" id="reset" value="<?=JText::_('COM_ALWORKSHOPS_RESET')?>" />
</div>
</div>
</form>
<div class="clear"></div>
<?php if ($this->item->kurzus=='Y') :?>
<h2><?=JText::_('COM_ALWORKSHOPS_SESSIONS')?></h2>
<form id="SessionController" action="/administrator/components/com_alworkshops/assets/ajax/AjaxSessionController.class.php" method="post" onsubmit="return submitForm('SessionController','tablediv2');">
<input type="hidden" name="title" value="" />
<input type="hidden" name="sid" value="" />
<input type="hidden" name="wid" value="<?=($this->item ? $this->item->id : 0)?>" />
<input type="hidden" name="description" value="" />
<input type="hidden" name="published" value="A" />
<input type="hidden" name="start_date" value="" />
<input type="hidden" name="finish_date" value="" />
<input type="hidden" name="refresh" value="" />
<input type="hidden" name="nojs" value="nojs" />
<input type="hidden" name="targetdiv" value="tablediv2" />
<div id="tablediv2"></div>
</form>
<?php endif; ?>
<h2><?=JText::_('COM_ALWORKSHOPS_APPLICATIONS')?></h2>
<form id="ApplicationController" action="/administrator/components/com_alworkshops/assets/ajax/AjaxApplicationController.class.php" method="post" onsubmit="return submitForm('ApplicationController','tablediv');">
<input type="hidden" name="title" id="title" value="" />
<input type="hidden" name="wid" id="wid" value="<?=($this->item ? $this->item->id : 0)?>" />
<input type="hidden" name="published" id="published" value="A" />
<input type="hidden" name="name" id="name" value="" />
<input type="hidden" name="uid" id="uid" value="" />
<input type="hidden" name="email" id="email" value="" />
<input type="hidden" name="start_date" value="" />
<input type="hidden" name="finish_date" value="" />
<input type="hidden" name="refresh" value="" />
<input type="hidden" name="nojs" value="nojs" />
<input type="hidden" name="targetdiv" value="tablediv" />
<div id="tablediv"></div>
</form>
</div>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#start_date").datepicker({dateFormat: "yy-mm-dd"});
jQuery("#finish_date").datepicker({dateFormat: "yy-mm-dd"});
submitForm('ApplicationController','tablediv');
<?php if ($this->item->kurzus=='Y') :?>
submitForm('SessionController','tablediv2');
<?php endif; ?>
});
function switchController(sel,txt)
{
jQuery("#"+sel).toggle();
jQuery("#"+txt).toggle();
}
</script>

View File

@ -1,90 +1,90 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
class AlworkshopsViewCourseEdit extends JViewLegacy
{
public $id;
public $editor;
public $pf='CourseEditController';
public function display($tpl = null)
{
JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/style.css');
JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/ajax.js');
JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/main.js');
// JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/jquery-ui.css');
// JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/jquery-ui.js');
$this->id=(int)$_GET['id'];
$model=$this->getModel();
if (isset($_POST['save']) || isset($_POST['saveexit']) || isset($_POST['savenew']))
{
$tomb = array(
"title"=>trim(addslashes( ($_POST['title_new']>'' ? $_POST['title_new'] : $_POST['title']) )),
"alias"=>trim(addslashes($_POST['alias'])),
"price"=>trim(addslashes($_POST['price'])),
"vat"=>(int)$_POST['vat'],
"min_attend"=>(int)$_POST['min_attend'],
"capacity"=>trim(addslashes($_POST['capacity'])),
"location"=>trim(addslashes($_POST['location'])),
"email_template"=>trim(addslashes($_POST['email_template'])),
"start_date"=>trim(addslashes($_POST['start_date'])),
"start_time"=>trim(addslashes($_POST['start_time'])),
"finish_date"=>trim(addslashes($_POST['finish_date'])),
"finish_time"=>trim(addslashes($_POST['finish_time'])),
"published"=>strtoupper(trim(addslashes($_POST['published']))),
"comment"=>trim($_POST['comment']),
"course_level"=>trim($_POST['course_level']),
"course_info"=>trim($_POST['course_info']),
"course_name"=>trim($_POST['course_name']),
"yt_link"=>trim($_POST['yt_link']),
"external_link"=>trim($_POST['external_link'])
);
if ($_FILES['thumbnail']['size'] > 0) {
$thumbnail_dir = "/public/img/webinar_thumbnails/";
$target_dir = $_SERVER["DOCUMENT_ROOT"].$thumbnail_dir;
$target_file = $target_dir.basename($_FILES["thumbnail"]["name"]);
$tomb['thumbnail'] = $thumbnail_dir.basename($_FILES["thumbnail"]["name"]);
if (!file_exists($target_file)) {
move_uploaded_file($_FILES["thumbnail"]["tmp_name"], $target_file);
}
}
if ($this->id)
{
$model->saveItem($tomb,$this->id);
}
else
{
$newID=$model->saveItem($tomb,NULL);
}
if (isset($_POST['save']) && !$this->id) { JFactory::getApplication()->redirect('index.php?option='.JFactory::getApplication()->input->get('option').'&view='.JFactory::getApplication()->input->get('view').'&id='.$newID); }
if (isset($_POST['savenew'])) { JFactory::getApplication()->redirect('index.php?option='.JFactory::getApplication()->input->get('option').'&view='.JFactory::getApplication()->input->get('view').'&id=0'); }
if (isset($_POST['saveexit'])){ JFactory::getApplication()->redirect('index.php?option='.JFactory::getApplication()->input->get('option').'&view='.substr(JFactory::getApplication()->input->get('view'),0,-4)); }
}
$this->item=$model->getItem($this->id);
$this->aliases=$model->getAliases();
$this->switch=$model->getSwitch($this->item->alias);
$this->titles=$model->getTitles();
$this->templates=$model->getTemplates();
if (isset($this->switch->comment) && $this->switch->comment==='Y') $this->editor=&JFactory::getEditor();
$this->addToolBar();
parent::display($tpl);
}
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_ALWORKSHOPS').' - '.($this->id=="0" ? jText::_('COM_ALWORKSHOPS_NEW') : jText::_('COM_ALWORKSHOPS_EDIT').": ".$this->item->title )." - ".$this->id);
}
}
?>
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
class AlworkshopsViewCourseEdit extends JViewLegacy
{
public $id;
public $editor;
public $pf='CourseEditController';
public function display($tpl = null)
{
JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/style.css');
JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/ajax.js');
JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/main.js');
// JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/jquery-ui.css');
// JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/jquery-ui.js');
$this->id=(int)$_GET['id'];
$model=$this->getModel();
if (isset($_POST['save']) || isset($_POST['saveexit']) || isset($_POST['savenew']))
{
$tomb = array(
"title"=>trim(addslashes( ($_POST['title_new']>'' ? $_POST['title_new'] : $_POST['title']) )),
"alias"=>trim(addslashes($_POST['alias'])),
"price"=>trim(addslashes($_POST['price'])),
"vat"=>(int)$_POST['vat'],
"min_attend"=>(int)$_POST['min_attend'],
"capacity"=>trim(addslashes($_POST['capacity'])),
"location"=>trim(addslashes($_POST['location'])),
"email_template"=>trim(addslashes($_POST['email_template'])),
"start_date"=>trim(addslashes($_POST['start_date'])),
"start_time"=>trim(addslashes($_POST['start_time'])),
"finish_date"=>trim(addslashes($_POST['finish_date'])),
"finish_time"=>trim(addslashes($_POST['finish_time'])),
"published"=>strtoupper(trim(addslashes($_POST['published']))),
"comment"=>trim($_POST['comment']),
"course_level"=>trim($_POST['course_level']),
"course_info"=>trim($_POST['course_info']),
"course_name"=>trim($_POST['course_name']),
"yt_link"=>trim($_POST['yt_link']),
"external_link"=>trim($_POST['external_link'])
);
if ($_FILES['thumbnail']['size'] > 0) {
$thumbnail_dir = "/public/img/webinar_thumbnails/";
$target_dir = $_SERVER["DOCUMENT_ROOT"].$thumbnail_dir;
$target_file = $target_dir.basename($_FILES["thumbnail"]["name"]);
$tomb['thumbnail'] = $thumbnail_dir.basename($_FILES["thumbnail"]["name"]);
if (!file_exists($target_file)) {
move_uploaded_file($_FILES["thumbnail"]["tmp_name"], $target_file);
}
}
if ($this->id)
{
$model->saveItem($tomb,$this->id);
}
else
{
$newID=$model->saveItem($tomb,NULL);
}
if (isset($_POST['save']) && !$this->id) { JFactory::getApplication()->redirect('index.php?option='.JFactory::getApplication()->input->get('option').'&view='.JFactory::getApplication()->input->get('view').'&id='.$newID); }
if (isset($_POST['savenew'])) { JFactory::getApplication()->redirect('index.php?option='.JFactory::getApplication()->input->get('option').'&view='.JFactory::getApplication()->input->get('view').'&id=0'); }
if (isset($_POST['saveexit'])){ JFactory::getApplication()->redirect('index.php?option='.JFactory::getApplication()->input->get('option').'&view='.substr(JFactory::getApplication()->input->get('view'),0,-4)); }
}
$this->item=$model->getItem($this->id);
$this->aliases=$model->getAliases();
$this->switch=$model->getSwitch($this->item->alias);
$this->titles=$model->getTitles();
$this->templates=$model->getTemplates();
if (isset($this->switch->comment) && $this->switch->comment==='Y') $this->editor=&JFactory::getEditor();
$this->addToolBar();
parent::display($tpl);
}
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_ALWORKSHOPS').' - '.($this->id=="0" ? jText::_('COM_ALWORKSHOPS_NEW') : jText::_('COM_ALWORKSHOPS_EDIT').": ".$this->item->title )." - ".$this->id);
}
}
?>

View File

@ -1,91 +1,91 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
JHtml::_('behavior.tooltip');
?>
<div id="j-sidebar-container" class="span2"><?= JHtmlSidebar::render() ?></div>
<div id="j-main-container" class="span10">
<form id="<?= $this->pf ?>" action="/administrator/components/<?= JFactory::getApplication()->input->get('option') ?>/assets/ajax/Ajax<?= $this->pf ?>.class.php" method="post" onsubmit="return submitForm('<?= $this->pf ?>','tablediv');">
<div class="hasab">
<div class="inputholder">
<label for="name"><?= JText::_('COM_ALWORKSHOPS_NAME') ?>:</label>
<input type="text" name="name" id="name" value="<?= $_SESSION[$this->pf]['_POST']['name'] ?>" maxlength="30" />
</div>
<div class="inputholder">
<label for="wid"><?= JText::_('COM_ALWORKSHOPS_ID') ?>:</label>
<input type="text" name="wid" id="wid" value="" maxlength="15" />
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="start_date"><?= JText::_('COM_ALWORKSHOPS_START_DATE') ?>:</label>
<input type="text" name="start_date" id="start_date" value="" maxlength="10" />
</div>
<div class="inputholder">
<label for="finish_date"><?= JText::_('COM_ALWORKSHOPS_FINISH_DATE') ?>:</label>
<input type="text" name="finish_date" id="finish_date" value="" maxlength="10" />
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="deleted_a"><?= JText::_('COM_ALWORKSHOPS_ONLYPAY') ?>:</label>
<fieldset>
<input type="radio" name="onlypay" id="onlypay_y" value="Y" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" /><label for="onlypay_y"><?= JText::_('COM_ALWORKSHOPS_YES') ?></label>
<input type="radio" name="onlypay" id="onlypay_n" value="N" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" /><label for="onlypay_n"><?= JText::_('COM_ALWORKSHOPS_NO') ?></label>
<input type="radio" name="onlypay" id="onlypay_a" value="A" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" checked="checked" /><label for="onlypay_a"><?= JText::_('COM_ALWORKSHOPS_ALL') ?></label>
</fieldset>
</div>
<div class="inputholder">
<label for="deleted_a"><?= JText::_('COM_ALWORKSHOPS_PUBLISHED') ?>:</label>
<fieldset>
<input type="radio" name="published" id="published_y" value="Y" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" /><label for="published_y"><?= JText::_('COM_ALWORKSHOPS_YES') ?></label>
<input type="radio" name="published" id="published_n" value="N" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" /><label for="published_n"><?= JText::_('COM_ALWORKSHOPS_NO') ?></label>
<input type="radio" name="published" id="published_a" value="A" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" checked="checked" /><label for="published_a"><?= JText::_('COM_ALWORKSHOPS_ALL') ?></label>
</fieldset>
</div>
</div>
<div class="clear"></div>
<div class="hasab">
<div class="inputholder">
<input type="submit" name="search" id="search" value="<?= JText::_('COM_ALWORKSHOPS_SEARCH') ?>" />
<input type="button" name="alap" id="alap" value="<?= JText::_('COM_ALWORKSHOPS_RESET') ?>" onclick="resetForm();" />
<input type="hidden" name="refresh" id="refresh" value="refresh" />
</div>
</div>
<div class="clear"></div>
<div id="tablediv"></div>
</form>
</div>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
function resetForm() {
jQuery(':text').each(function() {
jQuery(this).val('');
});
jQuery('#onlypay_a').attr('checked', 'checked');
jQuery('#published_a').attr('checked', 'checked');
submitForm('<?= $this->pf ?>', 'tablediv');
}
jQuery(document).ready(function() {
jQuery("#start_date").datepicker({
dateFormat: "yy-mm-dd"
});
jQuery("#finish_date").datepicker({
dateFormat: "yy-mm-dd"
});
submitForm('<?= $this->pf ?>', 'tablediv');
});
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
JHtml::_('behavior.tooltip');
?>
<div id="j-sidebar-container" class="span2"><?= JHtmlSidebar::render() ?></div>
<div id="j-main-container" class="span10">
<form id="<?= $this->pf ?>" action="/administrator/components/<?= JFactory::getApplication()->input->get('option') ?>/assets/ajax/Ajax<?= $this->pf ?>.class.php" method="post" onsubmit="return submitForm('<?= $this->pf ?>','tablediv');">
<div class="hasab">
<div class="inputholder">
<label for="name"><?= JText::_('COM_ALWORKSHOPS_NAME') ?>:</label>
<input type="text" name="name" id="name" value="<?= $_SESSION[$this->pf]['_POST']['name'] ?>" maxlength="30" />
</div>
<div class="inputholder">
<label for="wid"><?= JText::_('COM_ALWORKSHOPS_ID') ?>:</label>
<input type="text" name="wid" id="wid" value="" maxlength="15" />
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="start_date"><?= JText::_('COM_ALWORKSHOPS_START_DATE') ?>:</label>
<input type="text" name="start_date" id="start_date" value="" maxlength="10" />
</div>
<div class="inputholder">
<label for="finish_date"><?= JText::_('COM_ALWORKSHOPS_FINISH_DATE') ?>:</label>
<input type="text" name="finish_date" id="finish_date" value="" maxlength="10" />
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="deleted_a"><?= JText::_('COM_ALWORKSHOPS_ONLYPAY') ?>:</label>
<fieldset>
<input type="radio" name="onlypay" id="onlypay_y" value="Y" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" /><label for="onlypay_y"><?= JText::_('COM_ALWORKSHOPS_YES') ?></label>
<input type="radio" name="onlypay" id="onlypay_n" value="N" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" /><label for="onlypay_n"><?= JText::_('COM_ALWORKSHOPS_NO') ?></label>
<input type="radio" name="onlypay" id="onlypay_a" value="A" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" checked="checked" /><label for="onlypay_a"><?= JText::_('COM_ALWORKSHOPS_ALL') ?></label>
</fieldset>
</div>
<div class="inputholder">
<label for="deleted_a"><?= JText::_('COM_ALWORKSHOPS_PUBLISHED') ?>:</label>
<fieldset>
<input type="radio" name="published" id="published_y" value="Y" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" /><label for="published_y"><?= JText::_('COM_ALWORKSHOPS_YES') ?></label>
<input type="radio" name="published" id="published_n" value="N" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" /><label for="published_n"><?= JText::_('COM_ALWORKSHOPS_NO') ?></label>
<input type="radio" name="published" id="published_a" value="A" onclick="javascript:submitForm('<?= $this->pf ?>','tablediv');" checked="checked" /><label for="published_a"><?= JText::_('COM_ALWORKSHOPS_ALL') ?></label>
</fieldset>
</div>
</div>
<div class="clear"></div>
<div class="hasab">
<div class="inputholder">
<input type="submit" name="search" id="search" value="<?= JText::_('COM_ALWORKSHOPS_SEARCH') ?>" />
<input type="button" name="alap" id="alap" value="<?= JText::_('COM_ALWORKSHOPS_RESET') ?>" onclick="resetForm();" />
<input type="hidden" name="refresh" id="refresh" value="refresh" />
</div>
</div>
<div class="clear"></div>
<div id="tablediv"></div>
</form>
</div>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
function resetForm() {
jQuery(':text').each(function() {
jQuery(this).val('');
});
jQuery('#onlypay_a').attr('checked', 'checked');
jQuery('#published_a').attr('checked', 'checked');
submitForm('<?= $this->pf ?>', 'tablediv');
}
jQuery(document).ready(function() {
jQuery("#start_date").datepicker({
dateFormat: "yy-mm-dd"
});
jQuery("#finish_date").datepicker({
dateFormat: "yy-mm-dd"
});
submitForm('<?= $this->pf ?>', 'tablediv');
});
</script>

View File

@ -1,28 +1,28 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
class AlworkshopsViewEducation extends JViewLegacy
{
public $pf='EducationController';
public function display($tpl = null)
{
JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/style.css');
// JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/jquery-ui.css');
JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/ajax.js');
JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/main.js');
// JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/jquery-ui.js');
$this->addToolBar();
parent::display($tpl);
}
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_ALWORKSHOPS').' - '.JText::_('COM_ALWORKSHOPS_EDUCATION'));
JToolBarHelper::back(JText::_('COM_ALWORKSHOPS_NEW'), 'index.php?option='.JFactory::getApplication()->input->get('option').'&view='.JFactory::getApplication()->input->get('view').'edit&id=0');
}
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
class AlworkshopsViewEducation extends JViewLegacy
{
public $pf='EducationController';
public function display($tpl = null)
{
JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/style.css');
// JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/jquery-ui.css');
JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/ajax.js');
JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/main.js');
// JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/jquery-ui.js');
$this->addToolBar();
parent::display($tpl);
}
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_ALWORKSHOPS').' - '.JText::_('COM_ALWORKSHOPS_EDUCATION'));
JToolBarHelper::back(JText::_('COM_ALWORKSHOPS_NEW'), 'index.php?option='.JFactory::getApplication()->input->get('option').'&view='.JFactory::getApplication()->input->get('view').'edit&id=0');
}
}

View File

@ -1,286 +1,286 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
JHtml::_('behavior.tooltip');
?>
<style>
.button {
font: bold 12px Arial;
text-decoration: none;
background-color: #EEEEEE;
color: #333333;
padding: 2px 6px 2px 6px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
cursor: pointer;
text-decoration: none;
}
.button:link {
text-decoration: none;
color: #333333;
}
.button:visited {
text-decoration: none;
color: #333333;
}
.button:hover {
text-decoration: none;
color: #333333;
}
.button:active {
text-decoration: none;
color: #333333;
}
.custom-txt {
width: 50% !important;
}
.lessons-div {
margin-left: 10%;
}
</style>
<div id="j-sidebar-container"><?= JHtmlSidebar::render() ?></div>
<div id="j-main-container">
<form method="post" enctype="multipart/form-data">
<div id="education_form" class="hasab">
<div class="inputholder">
<label for="eid"><?= JText::_('COM_ALWORKSHOPS_ID') ?>:</label>
<input type="text" name="eid" id="eid" value="<?= $this->item->id ?>" maxlength="15" readonly="readonly" />
</div>
<div class="inputholder">
<label for="ename"><?= JText::_('COM_ALWORKSHOPS_TITLE') ?>:</label>
<input type="text" name="ename" id="ename" value="<?= $this->item->title ?>" />
</div>
<div class="inputholder">
<label for="published"><?= JText::_('COM_ALWORKSHOPS_PUBLISHED') ?>:</label>
<fieldset>
<input type="radio" name="published" id="published_y" value="Y" <?= ($this->item && $this->item->published === 'Y' ? 'checked="checked"' : '') ?> /><label for="published_y"><?= JText::_('COM_ALWORKSHOPS_YES') ?></label>
<input type="radio" name="published" id="published_n" value="N" <?= (!$this->item || $this->item->published === 'N' || trim($this->item->published) == '' ? 'checked="checked"' : '') ?> /><label for="published_n"><?= JText::_('COM_ALWORKSHOPS_NO') ?></label>
</fieldset>
</div>
<?php if ($this->item->id > 0) : ?>
<?php $j = 0; ?>
<?php foreach ($this->item->courses as $course) : ?>
<div class="row-div" id="row_<?= $j ?>">
<div class="inputholder">
<label for="courses">Course Name:</label>
<input type="text" name="courses[<?= $j ?>]" value="<?= $course->name ?>" />
</div>
<div class="inputholder">
<a class="button" onclick="addLesson(<?= $j ?>)">Add Lesson</a>
<a class="button" onclick="deleteCourse(<?= $j ?>)">Delete Course</a>
</div>
<hr>
<?php for ($i = 0; $i < count($course->lessons->name); $i++) : ?>
<b><?= ($i + 1) ?>.</b>
<div class="lessons-div-<?= $j ?>" id="lesson_<?= $j ?>_<?= $i ?>">
<div class="inputholder"><label for="lessons">Lesson Name:</label><input type="text" class="custom-txt" name="lesson[<?= $j ?>][name][]" value="<?= $course->lessons->name[$i] ?>"></div>
<div class="inputholder"><label for="lessons">Youtube Link:</label><input type="text" class="custom-txt" name="lesson[<?= $j ?>][yt_link][]" value="<?= $course->lessons->yt_link[$i] ?>"></div>
<a class="button" onclick="deleteLesson(<?= $j ?>, <?= $i ?>)">Delete Lesson</a>
<hr>
</div>
<?php endfor; ?>
</div>
<?php $j++; ?>
<?php endforeach; ?>
<?php else : ?>
<div id="row_0">
<div class="inputholder">
<label for="courses">Course Name:</label>
<input type="text" name="courses[0]" value="" />
</div>
<div class="inputholder">
<a class="button" onclick="addLesson(0)">Add Lesson</a>
</div>
<hr>
</div>
<?php endif; ?>
</div>
<div class="hasab">
<div class="inputholder">
<label for="thumbnail">Thumbnail:</label>
<input type="file" name="thumbnail" id="thumbnail">
</div>
<div class="inputholder">
<a href="<?= ($this->item ? $this->item->image : "") ?>" target="_blank"><?= ($this->item ? $this->item->image : "") ?></a>
</div>
<div class="inputholder">
<label for="overview_id">Overview ID:</label>
<input type="text" name="overview_id" id="overview_id" value="<?= ($this->item ? $this->item->overviewID : "") ?>" maxlength="100" />
</div>
<br>
<?php if ($this->item->id > 0 && $this->item->files && !empty($this->item->files)) : ?>
<div id="file_row">
<?php for ($i = 0; $i < count($this->item->files->name); $i++) : ?>
<b><?= ($i + 1) ?>.</b>
<div class="inputholder file-div">
<div class="inputholder">
<label for="lessons">File name:</label>
<input type="text" class="custom-txt" name="file_name[]" value="<?= $this->item->files->name[$i] ?>">
</div>
<div class="inputholder">
<label for="lessons">Article ID:</label>
<input type="text" class="custom-txt" name="article_id[]" value="<?= $this->item->files->article[$i] ?>">
</div>
<div class="inputholder">
<label for="lessons">Download Link:</label>
<input type="text" class="custom-txt" name="file_link[]" value="<?= $this->item->files->link[$i] ?>">
</div>
</div>
<hr style="margin-top: 76px;">
<?php endfor; ?>
</div>
<?php else : ?>
<div id="file_row">
<b>1.</b>
<div class="inputholder file-div">
<div class="inputholder">
<label for="lessons">File name:</label>
<input type="text" class="custom-txt" name="file_name[]" value="">
</div>
<div class="inputholder">
<label for="lessons">Article ID:</label>
<input type="text" class="custom-txt" name="article_id[]" value="">
</div>
<div class="inputholder">
<label for="lessons">Download Link:</label>
<input type="text" class="custom-txt" name="file_link[]" value="">
</div>
</div>
<hr style="margin-top: 76px;">
</div>
<?php endif; ?>
</div>
<div class="hasab">
<div class="inputholder">
<a class="button add_course">Add Course</a>
</div>
<div class="inputholder">
<a class="button add_file">Add File</a>
</div>
</div>
<br>
<br>
<div class="clear"></div>
<div class="hasab">
<div class="inputholder">
<input type="submit" name="save" id="save" value="<?= JText::_('COM_ALWORKSHOPS_SAVE') ?>" />
<input type="submit" name="savenew" id="savenew" value="<?= JText::_('COM_ALWORKSHOPS_SAVE') ?> & <?= JText::_('COM_ALWORKSHOPS_NEW') ?>" />
<input type="submit" name="saveexit" id="saveexit" value="<?= JText::_('COM_ALWORKSHOPS_SAVE') ?> & <?= JText::_('COM_ALWORKSHOPS_EXIT') ?>" />
<input type="button" name="exit" id="exit" value="<?= JText::_('COM_ALWORKSHOPS_EXIT') ?>" onclick="document.location.href='index.php?option=<?= JFactory::getApplication()->input->get('option') ?>&view=<?= substr(JFactory::getApplication()->input->get('view'), 0, -4) ?>';" />
<input type="reset" name="reset" id="reset" value="<?= JText::_('COM_ALWORKSHOPS_RESET') ?>" />
</div>
</div>
</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
var increment = jQuery('.row-div').length;
jQuery('.add_course').click(function(e) {
let html = '<div class="row-div" id="row_' + increment + '">';
html += '<div class="inputholder">';
html += '<label for="courses">Course Name:</label>';
html += '<input type="text" name="courses[' + increment + ']" value="" />';
html += '</div>';
html += '<div class="inputholder">';
html += '<a class="button" onclick="addLesson(' + increment + ')">Add Lesson</a>';
html += '<a class="button" onclick="deleteCourse(' + increment + ')">Delete Course</a>';
html += '</div>';
html += '<hr>';
html += '</div>';
jQuery('#education_form').append(html);
increment++;
});
jQuery('.add_file').click(function(e) {
let counter = jQuery('.file-div').length;
let html = '<b>' + (counter + 1) + '.</b>';
html += '<div class="inputholder file-div">';
html += '<div class="inputholder">';
html += '<label for="lessons">File name:</label>';
html += '<input type="text" class="custom-txt" name="file_name[]" value="">';
html += '</div>';
html += '<div class="inputholder">';
html += '<label for="lessons">Article ID:</label>';
html += '<input type="text" class="custom-txt" name="article_id[]" value="">';
html += '</div>';
html += '<div class="inputholder">';
html += '<label for="lessons">Download Link:</label>';
html += '<input type="text" class="custom-txt" name="file_link[]" value="">';
html += '</div></div>';
html += '<hr style="margin-top: 76px;">';
jQuery('#file_row').append(html);
});
});
function addLesson(id) {
let elemCount = jQuery('#row_' + id).children('.lessons-div-' + id).length + 1;
let lessonCount = jQuery('.lessons-div-' + id).length;
let html = '<b>' + elemCount + '.</b><div class="lessons-div-' + id + '" id="lesson_' + id + '_' + lessonCount + '">';
html += '<div class="inputholder">';
html += '<label for="lessons">Lesson Name:</label>';
html += '<input type="text" class="custom-txt" name="lesson[' + id + '][name][]" value="" />';
html += '</div>';
html += '<div class="inputholder">';
html += '<label for="lessons">Youtube Link:</label>';
html += '<input type="text" class="custom-txt" name="lesson[' + id + '][yt_link][]" value="" />';
html += '</div>';
html += '<a class="button" onclick="deleteLesson(' + id + ', ' + lessonCount + ')">Delete Lesson</a>';
html += '<hr>';
html += '</div>';
jQuery('#row_' + id).append(html);
}
function deleteCourse(id) {
jQuery('#row_' + id).remove();
}
function deleteLesson(j, i) {
jQuery('#lesson_' + j + '_' + i).remove();
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
JHtml::_('behavior.tooltip');
?>
<style>
.button {
font: bold 12px Arial;
text-decoration: none;
background-color: #EEEEEE;
color: #333333;
padding: 2px 6px 2px 6px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
cursor: pointer;
text-decoration: none;
}
.button:link {
text-decoration: none;
color: #333333;
}
.button:visited {
text-decoration: none;
color: #333333;
}
.button:hover {
text-decoration: none;
color: #333333;
}
.button:active {
text-decoration: none;
color: #333333;
}
.custom-txt {
width: 50% !important;
}
.lessons-div {
margin-left: 10%;
}
</style>
<div id="j-sidebar-container"><?= JHtmlSidebar::render() ?></div>
<div id="j-main-container">
<form method="post" enctype="multipart/form-data">
<div id="education_form" class="hasab">
<div class="inputholder">
<label for="eid"><?= JText::_('COM_ALWORKSHOPS_ID') ?>:</label>
<input type="text" name="eid" id="eid" value="<?= $this->item->id ?>" maxlength="15" readonly="readonly" />
</div>
<div class="inputholder">
<label for="ename"><?= JText::_('COM_ALWORKSHOPS_TITLE') ?>:</label>
<input type="text" name="ename" id="ename" value="<?= $this->item->title ?>" />
</div>
<div class="inputholder">
<label for="published"><?= JText::_('COM_ALWORKSHOPS_PUBLISHED') ?>:</label>
<fieldset>
<input type="radio" name="published" id="published_y" value="Y" <?= ($this->item && $this->item->published === 'Y' ? 'checked="checked"' : '') ?> /><label for="published_y"><?= JText::_('COM_ALWORKSHOPS_YES') ?></label>
<input type="radio" name="published" id="published_n" value="N" <?= (!$this->item || $this->item->published === 'N' || trim($this->item->published) == '' ? 'checked="checked"' : '') ?> /><label for="published_n"><?= JText::_('COM_ALWORKSHOPS_NO') ?></label>
</fieldset>
</div>
<?php if ($this->item->id > 0) : ?>
<?php $j = 0; ?>
<?php foreach ($this->item->courses as $course) : ?>
<div class="row-div" id="row_<?= $j ?>">
<div class="inputholder">
<label for="courses">Course Name:</label>
<input type="text" name="courses[<?= $j ?>]" value="<?= $course->name ?>" />
</div>
<div class="inputholder">
<a class="button" onclick="addLesson(<?= $j ?>)">Add Lesson</a>
<a class="button" onclick="deleteCourse(<?= $j ?>)">Delete Course</a>
</div>
<hr>
<?php for ($i = 0; $i < count($course->lessons->name); $i++) : ?>
<b><?= ($i + 1) ?>.</b>
<div class="lessons-div-<?= $j ?>" id="lesson_<?= $j ?>_<?= $i ?>">
<div class="inputholder"><label for="lessons">Lesson Name:</label><input type="text" class="custom-txt" name="lesson[<?= $j ?>][name][]" value="<?= $course->lessons->name[$i] ?>"></div>
<div class="inputholder"><label for="lessons">Youtube Link:</label><input type="text" class="custom-txt" name="lesson[<?= $j ?>][yt_link][]" value="<?= $course->lessons->yt_link[$i] ?>"></div>
<a class="button" onclick="deleteLesson(<?= $j ?>, <?= $i ?>)">Delete Lesson</a>
<hr>
</div>
<?php endfor; ?>
</div>
<?php $j++; ?>
<?php endforeach; ?>
<?php else : ?>
<div id="row_0">
<div class="inputholder">
<label for="courses">Course Name:</label>
<input type="text" name="courses[0]" value="" />
</div>
<div class="inputholder">
<a class="button" onclick="addLesson(0)">Add Lesson</a>
</div>
<hr>
</div>
<?php endif; ?>
</div>
<div class="hasab">
<div class="inputholder">
<label for="thumbnail">Thumbnail:</label>
<input type="file" name="thumbnail" id="thumbnail">
</div>
<div class="inputholder">
<a href="<?= ($this->item ? $this->item->image : "") ?>" target="_blank"><?= ($this->item ? $this->item->image : "") ?></a>
</div>
<div class="inputholder">
<label for="overview_id">Overview ID:</label>
<input type="text" name="overview_id" id="overview_id" value="<?= ($this->item ? $this->item->overviewID : "") ?>" maxlength="100" />
</div>
<br>
<?php if ($this->item->id > 0 && $this->item->files && !empty($this->item->files)) : ?>
<div id="file_row">
<?php for ($i = 0; $i < count($this->item->files->name); $i++) : ?>
<b><?= ($i + 1) ?>.</b>
<div class="inputholder file-div">
<div class="inputholder">
<label for="lessons">File name:</label>
<input type="text" class="custom-txt" name="file_name[]" value="<?= $this->item->files->name[$i] ?>">
</div>
<div class="inputholder">
<label for="lessons">Article ID:</label>
<input type="text" class="custom-txt" name="article_id[]" value="<?= $this->item->files->article[$i] ?>">
</div>
<div class="inputholder">
<label for="lessons">Download Link:</label>
<input type="text" class="custom-txt" name="file_link[]" value="<?= $this->item->files->link[$i] ?>">
</div>
</div>
<hr style="margin-top: 76px;">
<?php endfor; ?>
</div>
<?php else : ?>
<div id="file_row">
<b>1.</b>
<div class="inputholder file-div">
<div class="inputholder">
<label for="lessons">File name:</label>
<input type="text" class="custom-txt" name="file_name[]" value="">
</div>
<div class="inputholder">
<label for="lessons">Article ID:</label>
<input type="text" class="custom-txt" name="article_id[]" value="">
</div>
<div class="inputholder">
<label for="lessons">Download Link:</label>
<input type="text" class="custom-txt" name="file_link[]" value="">
</div>
</div>
<hr style="margin-top: 76px;">
</div>
<?php endif; ?>
</div>
<div class="hasab">
<div class="inputholder">
<a class="button add_course">Add Course</a>
</div>
<div class="inputholder">
<a class="button add_file">Add File</a>
</div>
</div>
<br>
<br>
<div class="clear"></div>
<div class="hasab">
<div class="inputholder">
<input type="submit" name="save" id="save" value="<?= JText::_('COM_ALWORKSHOPS_SAVE') ?>" />
<input type="submit" name="savenew" id="savenew" value="<?= JText::_('COM_ALWORKSHOPS_SAVE') ?> & <?= JText::_('COM_ALWORKSHOPS_NEW') ?>" />
<input type="submit" name="saveexit" id="saveexit" value="<?= JText::_('COM_ALWORKSHOPS_SAVE') ?> & <?= JText::_('COM_ALWORKSHOPS_EXIT') ?>" />
<input type="button" name="exit" id="exit" value="<?= JText::_('COM_ALWORKSHOPS_EXIT') ?>" onclick="document.location.href='index.php?option=<?= JFactory::getApplication()->input->get('option') ?>&view=<?= substr(JFactory::getApplication()->input->get('view'), 0, -4) ?>';" />
<input type="reset" name="reset" id="reset" value="<?= JText::_('COM_ALWORKSHOPS_RESET') ?>" />
</div>
</div>
</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
var increment = jQuery('.row-div').length;
jQuery('.add_course').click(function(e) {
let html = '<div class="row-div" id="row_' + increment + '">';
html += '<div class="inputholder">';
html += '<label for="courses">Course Name:</label>';
html += '<input type="text" name="courses[' + increment + ']" value="" />';
html += '</div>';
html += '<div class="inputholder">';
html += '<a class="button" onclick="addLesson(' + increment + ')">Add Lesson</a>';
html += '<a class="button" onclick="deleteCourse(' + increment + ')">Delete Course</a>';
html += '</div>';
html += '<hr>';
html += '</div>';
jQuery('#education_form').append(html);
increment++;
});
jQuery('.add_file').click(function(e) {
let counter = jQuery('.file-div').length;
let html = '<b>' + (counter + 1) + '.</b>';
html += '<div class="inputholder file-div">';
html += '<div class="inputholder">';
html += '<label for="lessons">File name:</label>';
html += '<input type="text" class="custom-txt" name="file_name[]" value="">';
html += '</div>';
html += '<div class="inputholder">';
html += '<label for="lessons">Article ID:</label>';
html += '<input type="text" class="custom-txt" name="article_id[]" value="">';
html += '</div>';
html += '<div class="inputholder">';
html += '<label for="lessons">Download Link:</label>';
html += '<input type="text" class="custom-txt" name="file_link[]" value="">';
html += '</div></div>';
html += '<hr style="margin-top: 76px;">';
jQuery('#file_row').append(html);
});
});
function addLesson(id) {
let elemCount = jQuery('#row_' + id).children('.lessons-div-' + id).length + 1;
let lessonCount = jQuery('.lessons-div-' + id).length;
let html = '<b>' + elemCount + '.</b><div class="lessons-div-' + id + '" id="lesson_' + id + '_' + lessonCount + '">';
html += '<div class="inputholder">';
html += '<label for="lessons">Lesson Name:</label>';
html += '<input type="text" class="custom-txt" name="lesson[' + id + '][name][]" value="" />';
html += '</div>';
html += '<div class="inputholder">';
html += '<label for="lessons">Youtube Link:</label>';
html += '<input type="text" class="custom-txt" name="lesson[' + id + '][yt_link][]" value="" />';
html += '</div>';
html += '<a class="button" onclick="deleteLesson(' + id + ', ' + lessonCount + ')">Delete Lesson</a>';
html += '<hr>';
html += '</div>';
jQuery('#row_' + id).append(html);
}
function deleteCourse(id) {
jQuery('#row_' + id).remove();
}
function deleteLesson(j, i) {
jQuery('#lesson_' + j + '_' + i).remove();
}
</script>

View File

@ -1,80 +1,80 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
class AlworkshopsViewEducationEdit extends JViewLegacy
{
public $id;
public $pf = 'EducationEditController';
public function display($tpl = null)
{
JFactory::getDocument()->addStyleSheet('/administrator/components/' . JFactory::getApplication()->input->get('option') . '/assets/css/style.css');
// JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/jquery-ui.css');
// JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/jquery-ui.js');
$this->id = (int)$_GET['id'];
$model = $this->getModel();
if (isset($_POST['save']) || isset($_POST['saveexit']) || isset($_POST['savenew']) && $_POST['ename'] != '') {
$tomb = array(
"title" => trim(addslashes($_POST['ename'])),
"courses" => $_POST['courses'],
"published" => strtoupper(trim(addslashes($_POST['published']))),
"lessons" => $_POST['lesson'],
"fileNames" => $_POST['file_name'],
"fileLinks" => $_POST['file_link'],
"articleID" => $_POST['article_id'],
"overviewID" => $_POST['overview_id']
);
if ($_FILES['thumbnail']['size'] > 0) {
$thumbnail_dir = "/public/img/education_thumbnails/";
$target_dir = $_SERVER["DOCUMENT_ROOT"] . $thumbnail_dir;
$target_file = $target_dir . basename($_FILES["thumbnail"]["name"]);
$tomb['thumbnail'] = $thumbnail_dir . basename($_FILES["thumbnail"]["name"]);
if (!file_exists($target_file)) {
move_uploaded_file($_FILES["thumbnail"]["tmp_name"], $target_file);
}
}
if ($this->id && $this->id > 0) {
$model->saveItem($tomb, $this->id);
} else {
$newID = $model->saveItem($tomb, NULL);
}
if (isset($_POST['save']) && !$this->id) {
JFactory::getApplication()->redirect('index.php?option=' . JFactory::getApplication()->input->get('option') . '&view=' . JFactory::getApplication()->input->get('view') . '&id=' . $newID);
}
if (isset($_POST['savenew'])) {
JFactory::getApplication()->redirect('index.php?option=' . JFactory::getApplication()->input->get('option') . '&view=' . JFactory::getApplication()->input->get('view') . '&id=0');
}
if (isset($_POST['saveexit'])) {
JFactory::getApplication()->redirect('index.php?option=' . JFactory::getApplication()->input->get('option') . '&view=' . substr(JFactory::getApplication()->input->get('view'), 0, -4));
}
}
$this->item = $model->getItem($this->id);
if ($this->id && $this->id > 0) {
$this->item->courses = json_decode($this->item->lessons)->courses;
$this->item->files = json_decode($this->item->fileDownloadLink)->files;
}
$this->addToolBar();
parent::display($tpl);
}
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_ALWORKSHOPS') . ' - ' . JText::_('COM_ALWORKSHOPS_EDUCATION') . ' - ' . ($this->id == "0" ? jText::_('COM_ALWORKSHOPS_NEW') : jText::_('COM_ALWORKSHOPS_EDIT') . ": " . $this->id));
}
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
class AlworkshopsViewEducationEdit extends JViewLegacy
{
public $id;
public $pf = 'EducationEditController';
public function display($tpl = null)
{
JFactory::getDocument()->addStyleSheet('/administrator/components/' . JFactory::getApplication()->input->get('option') . '/assets/css/style.css');
// JFactory::getDocument()->addStyleSheet('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/css/jquery-ui.css');
// JFactory::getDocument()->addScript('/administrator/components/'.JFactory::getApplication()->input->get('option').'/assets/js/jquery-ui.js');
$this->id = (int)$_GET['id'];
$model = $this->getModel();
if (isset($_POST['save']) || isset($_POST['saveexit']) || isset($_POST['savenew']) && $_POST['ename'] != '') {
$tomb = array(
"title" => trim(addslashes($_POST['ename'])),
"courses" => $_POST['courses'],
"published" => strtoupper(trim(addslashes($_POST['published']))),
"lessons" => $_POST['lesson'],
"fileNames" => $_POST['file_name'],
"fileLinks" => $_POST['file_link'],
"articleID" => $_POST['article_id'],
"overviewID" => $_POST['overview_id']
);
if ($_FILES['thumbnail']['size'] > 0) {
$thumbnail_dir = "/public/img/education_thumbnails/";
$target_dir = $_SERVER["DOCUMENT_ROOT"] . $thumbnail_dir;
$target_file = $target_dir . basename($_FILES["thumbnail"]["name"]);
$tomb['thumbnail'] = $thumbnail_dir . basename($_FILES["thumbnail"]["name"]);
if (!file_exists($target_file)) {
move_uploaded_file($_FILES["thumbnail"]["tmp_name"], $target_file);
}
}
if ($this->id && $this->id > 0) {
$model->saveItem($tomb, $this->id);
} else {
$newID = $model->saveItem($tomb, NULL);
}
if (isset($_POST['save']) && !$this->id) {
JFactory::getApplication()->redirect('index.php?option=' . JFactory::getApplication()->input->get('option') . '&view=' . JFactory::getApplication()->input->get('view') . '&id=' . $newID);
}
if (isset($_POST['savenew'])) {
JFactory::getApplication()->redirect('index.php?option=' . JFactory::getApplication()->input->get('option') . '&view=' . JFactory::getApplication()->input->get('view') . '&id=0');
}
if (isset($_POST['saveexit'])) {
JFactory::getApplication()->redirect('index.php?option=' . JFactory::getApplication()->input->get('option') . '&view=' . substr(JFactory::getApplication()->input->get('view'), 0, -4));
}
}
$this->item = $model->getItem($this->id);
if ($this->id && $this->id > 0) {
$this->item->courses = json_decode($this->item->lessons)->courses;
$this->item->files = json_decode($this->item->fileDownloadLink)->files;
}
$this->addToolBar();
parent::display($tpl);
}
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_ALWORKSHOPS') . ' - ' . JText::_('COM_ALWORKSHOPS_EDUCATION') . ' - ' . ($this->id == "0" ? jText::_('COM_ALWORKSHOPS_NEW') : jText::_('COM_ALWORKSHOPS_EDIT') . ": " . $this->id));
}
}

View File

@ -1,89 +1,89 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
JHtml::_('behavior.tooltip');
?>
<div id="j-sidebar-container"><?=JHtmlSidebar::render()?></div>
<div id="j-main-container">
<form method="post" enctype="multipart/form-data">
<div class="hasab">
<div class="inputholder">
<label for="sid"><?=JText::_('COM_ALWORKSHOPS_ID')?>:</label>
<input type="text" name="sid" id="sid" value="<?=($this->item ? $this->item->id : '')?>" maxlength="15" readonly="readonly" />
</div>
<div class="inputholder">
<label for="courseid"><?=JText::_('COM_ALWORKSHOPS_COURSEID')?>:</label>
<select name="courseid" id="courseid">
<?php foreach($this->courses as $course) : ?>
<option value="<?=$course->id?>" <?=($this->item->courseid==$course->id ? 'selected="selected"' : "")?>><?=$course->title?>: <?=$course->start_date?>-<?=$course->finish_date?> [<?=$course->id?>]</option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="title"><?=JText::_('COM_ALWORKSHOPS_TITLE')?>:</label>
<select name="title" id="title">
<?php foreach($this->titles as $title) : ?>
<option value="<?=$title->title?>" <?=($this->item->title==$title->title ? 'selected="selected"' : "")?>><?=$title->title?></option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="session_date"><?=JText::_('COM_ALWORKSHOPS_START_DATE')?>:</label>
<input type="text" name="session_date" id="session_date" value="<?=($this->item ? $this->item->session_date : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="start_time"><?=JText::_('COM_ALWORKSHOPS_START_TIME')?>:</label>
<input type="text" name="start_time" id="start_time" value="<?=($this->item ? $this->item->start_time : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="finish_time"><?=JText::_('COM_ALWORKSHOPS_FINISH_TIME')?>:</label>
<input type="text" name="finish_time" id="finish_time" value="<?=($this->item ? $this->item->finish_time : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="duration"><?=JText::_('COM_ALWORKSHOPS_DURATION')?>:</label>
<input type="text" name="duration" id="duration" value="<?=($this->item ? $this->item->duration : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="switchid"><?=JText::_('COM_ALWORKSHOPS_SESSIONDESC')?>:</label>
<select name="switchid" id="switchid">
<?php foreach($this->descriptions as $description) : ?>
<option value="<?=$description->switchid?>" <?=($this->item->switchid==$description->switchid ? 'selected="selected"' : "")?>><?=$description->title?></option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="ordering"><?=JText::_('COM_ALWORKSHOPS_ORDERING')?>:</label>
<input type="text" name="ordering" id="ordering" value="<?=($this->item ? $this->item->ordering : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="published"><?=JText::_('COM_ALWORKSHOPS_PUBLISHED')?>:</label>
<fieldset>
<input type="radio" name="published" id="published_y" value="Y" <?=($this->item && $this->item->published==='Y' ? 'checked="checked"' : '')?> /><label for="published_y"><?=JText::_('COM_ALWORKSHOPS_YES')?></label>
<input type="radio" name="published" id="published_n" value="N" <?=(!$this->item || $this->item->published==='N' || trim($this->item->published)=='' ? 'checked="checked"' : '')?> /><label for="published_n"><?=JText::_('COM_ALWORKSHOPS_NO')?></label>
</fieldset>
</div>
</div>
<div class="clear"></div>
<div class="hasab">
<div class="inputholder">
<input type="submit" name="save" id="save" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?>" />
<input type="submit" name="savenew" id="savenew" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?> & <?=JText::_('COM_ALWORKSHOPS_NEW')?>" />
<input type="submit" name="saveexit" id="saveexit" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?> & <?=JText::_('COM_ALWORKSHOPS_EXIT')?>" />
<input type="button" name="exit" id="exit" value="<?=JText::_('COM_ALWORKSHOPS_EXIT')?>" onclick="document.location.href='index.php?option=<?=JFactory::getApplication()->input->get('option')?>&view=<?=substr(JFactory::getApplication()->input->get('view'),0,-4)?>';" />
<input type="reset" name="reset" id="reset" value="<?=JText::_('COM_ALWORKSHOPS_RESET')?>" />
</div>
</div>
</form>
</div>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#session_date").datepicker({dateFormat: "yy-mm-dd"});
});
</script>
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
JHtml::_('behavior.tooltip');
?>
<div id="j-sidebar-container"><?=JHtmlSidebar::render()?></div>
<div id="j-main-container">
<form method="post" enctype="multipart/form-data">
<div class="hasab">
<div class="inputholder">
<label for="sid"><?=JText::_('COM_ALWORKSHOPS_ID')?>:</label>
<input type="text" name="sid" id="sid" value="<?=($this->item ? $this->item->id : '')?>" maxlength="15" readonly="readonly" />
</div>
<div class="inputholder">
<label for="courseid"><?=JText::_('COM_ALWORKSHOPS_COURSEID')?>:</label>
<select name="courseid" id="courseid">
<?php foreach($this->courses as $course) : ?>
<option value="<?=$course->id?>" <?=($this->item->courseid==$course->id ? 'selected="selected"' : "")?>><?=$course->title?>: <?=$course->start_date?>-<?=$course->finish_date?> [<?=$course->id?>]</option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="title"><?=JText::_('COM_ALWORKSHOPS_TITLE')?>:</label>
<select name="title" id="title">
<?php foreach($this->titles as $title) : ?>
<option value="<?=$title->title?>" <?=($this->item->title==$title->title ? 'selected="selected"' : "")?>><?=$title->title?></option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="session_date"><?=JText::_('COM_ALWORKSHOPS_START_DATE')?>:</label>
<input type="text" name="session_date" id="session_date" value="<?=($this->item ? $this->item->session_date : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="start_time"><?=JText::_('COM_ALWORKSHOPS_START_TIME')?>:</label>
<input type="text" name="start_time" id="start_time" value="<?=($this->item ? $this->item->start_time : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="finish_time"><?=JText::_('COM_ALWORKSHOPS_FINISH_TIME')?>:</label>
<input type="text" name="finish_time" id="finish_time" value="<?=($this->item ? $this->item->finish_time : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="duration"><?=JText::_('COM_ALWORKSHOPS_DURATION')?>:</label>
<input type="text" name="duration" id="duration" value="<?=($this->item ? $this->item->duration : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="switchid"><?=JText::_('COM_ALWORKSHOPS_SESSIONDESC')?>:</label>
<select name="switchid" id="switchid">
<?php foreach($this->descriptions as $description) : ?>
<option value="<?=$description->switchid?>" <?=($this->item->switchid==$description->switchid ? 'selected="selected"' : "")?>><?=$description->title?></option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="ordering"><?=JText::_('COM_ALWORKSHOPS_ORDERING')?>:</label>
<input type="text" name="ordering" id="ordering" value="<?=($this->item ? $this->item->ordering : '')?>" maxlength="10" />
</div>
<div class="inputholder">
<label for="published"><?=JText::_('COM_ALWORKSHOPS_PUBLISHED')?>:</label>
<fieldset>
<input type="radio" name="published" id="published_y" value="Y" <?=($this->item && $this->item->published==='Y' ? 'checked="checked"' : '')?> /><label for="published_y"><?=JText::_('COM_ALWORKSHOPS_YES')?></label>
<input type="radio" name="published" id="published_n" value="N" <?=(!$this->item || $this->item->published==='N' || trim($this->item->published)=='' ? 'checked="checked"' : '')?> /><label for="published_n"><?=JText::_('COM_ALWORKSHOPS_NO')?></label>
</fieldset>
</div>
</div>
<div class="clear"></div>
<div class="hasab">
<div class="inputholder">
<input type="submit" name="save" id="save" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?>" />
<input type="submit" name="savenew" id="savenew" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?> & <?=JText::_('COM_ALWORKSHOPS_NEW')?>" />
<input type="submit" name="saveexit" id="saveexit" value="<?=JText::_('COM_ALWORKSHOPS_SAVE')?> & <?=JText::_('COM_ALWORKSHOPS_EXIT')?>" />
<input type="button" name="exit" id="exit" value="<?=JText::_('COM_ALWORKSHOPS_EXIT')?>" onclick="document.location.href='index.php?option=<?=JFactory::getApplication()->input->get('option')?>&view=<?=substr(JFactory::getApplication()->input->get('view'),0,-4)?>';" />
<input type="reset" name="reset" id="reset" value="<?=JText::_('COM_ALWORKSHOPS_RESET')?>" />
</div>
</div>
</form>
</div>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#session_date").datepicker({dateFormat: "yy-mm-dd"});
});
</script>

View File

@ -1,85 +1,85 @@
<?php
require_once('BaseController.class.php');
class Controller extends BaseController {
protected $lang;
public $pf='FollowedlinksController';
public function procEvent() {
if (!isset($_SESSION[$this->pf]["_POST"]) || trim($_POST['refresh'])=='' ) $_SESSION[$this->pf]["_POST"]=$_POST;
$se=&$_SESSION[$this->pf]['_POST'];
$felt="";
$arrIcons=array(
'smallEdit'=>array("href"=>"index.php?option=com_followedlinks&view=linkedit&id=REPLACE", "img"=>IconHelper::getIcon("smallEdit"), "linkjoin"=>"id","alttext"=>"Edit" ),
);
if ($this->auth()==FALSE) die();
if (!isset($_SESSION[$this->pf]['tableorder'])) $_SESSION[$this->pf]['tableorder']='id DESC';
if (isset($se['string']) && trim($se['string'])>"") $felt.=" AND (`name` LIKE '%".trim($se['string'])."%' OR `alias` LIKE '%".trim($se['string'])."%' OR `esem_cont` LIKE '%".trim($se['string'])."%' OR `redirect` LIKE '%".trim($se['string'])."%')";
$cl=($this->getLang()=='hun' ? 'hu-HU' : 'en-GB');
$LANG=parse_ini_file($_SERVER['DOCUMENT_ROOT']."/administrator/language/".$cl."/".$cl.".com_followedlinks.ini");
$objTabla=New TableHelper();
$objTabla->setParams(array('prefix'=>$this->pf,'tablewidth'=>'100%','tablediv'=>'tablediv'));
$v=$objTabla->setSession();
$objTabla->setColumn('id',array('header'=>'Id','width'=>'40px','link'=>'index.php?option=com_followedlinks&view=linkedit&id=REPLACE'));
$objTabla->setColumn('name',array('header'=>$LANG['COM_FOLLOWEDLINKS_NAME'],'format'=>'text','align'=>'left','strlen'=>30,'width'=>'200px','link'=>'index.php?option=com_followedlinks&view=linkedit&id=REPLACE','linkjoin'=>'id'));
$objTabla->setColumn('alias',array('header'=>$LANG['COM_FOLLOWEDLINKS_ALIAS'],'format'=>'text','align'=>'left'));
$objTabla->setColumn('esem_id',array('header'=>str_replace(' ', '<br />', $LANG['COM_FOLLOWEDLINKS_EVENT_NUMBER']),'format'=>'number','decimal'=>0,'width'=>'50px'));
$objTabla->setColumn('esem_cont',array('header'=>$LANG['COM_FOLLOWEDLINKS_EVENT_CONTENT'],'format'=>'text','align'=>'left','strlen'=>30,'width'=>'200px'));
$objTabla->setColumn('redirect',array('header'=>$LANG['COM_FOLLOWEDLINKS_REDIRECT'],'format'=>'text','align'=>'left'));
$objTabla->setColumn('options',array('header'=>$LANG['COM_FOLLOWEDLINKS_OPTIONS'],'align'=>'right','width'=>'60px','order'=>false,'addicons'=>$arrIcons,'linkjoin'=>'id'));
$objTabla->setQuery(array("
SELECT id,name,alias,esem_id,esem_cont,REPLACE(REPLACE(`redirect`,'http://www.archline.hu',''),'http://www.archlinexp.com','') AS redirect,'smallEdit' AS options
FROM followed_links
WHERE `lang`='".$this->getLang()."' ".$felt
.((isset($v['tableorder']) and $v['tableorder']>'') ? ' ORDER BY '.$v['tableorder'] : '')
.((isset($v['tableipp'])) ? ' LIMIT '.($v['tableipp']>0 ? ($v['tablepage']-1)*$v['tableipp'] : 0) .','.$v['tableipp'] : ''),"
SELECT COUNT(*) AS recordCount
FROM (
SELECT *
FROM followed_links
WHERE `lang`='".$this->getLang()."' ".$felt."
) x"
));
// $this->printSession($this->pf);
// print "<pre>".print_r($_SESSION,true)."</pre>";
$objTabla->drawTable(TRUE);
}
public function auth()
{
MySqlHelper::getInstance()->query("
(SELECT * FROM jml_session where session_id='".trim(addslashes($_POST['sess']))."' LIMIT 1)
UNION
(SELECT * FROM eng_session where session_id='".trim(addslashes($_POST['sess']))."' LIMIT 1);");
$sess=MySqlHelper::getInstance()->fetchAssoc();
if (count($sess))
{
MySqlHelper::getInstance()->query("SELECT * FROM jml_user_usergroup_map where group_id IN (7,8) AND user_id=".$sess[0]['userid'].";");
$admin=MySqlHelper::getInstance()->fetchAssoc();
return (count($admin) ? TRUE : FALSE);
}
else
{
return(FALSE);
}
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=(strpos( $_SERVER['HTTP_HOST'], ".com") ? "eng" : "hun"); }
return $this->lang;
}
} // end of class
$controller=new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value','');
jQuery("#string").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["string"]?>');
</script>
<?php
require_once('BaseController.class.php');
class Controller extends BaseController {
protected $lang;
public $pf='FollowedlinksController';
public function procEvent() {
if (!isset($_SESSION[$this->pf]["_POST"]) || trim($_POST['refresh'])=='' ) $_SESSION[$this->pf]["_POST"]=$_POST;
$se=&$_SESSION[$this->pf]['_POST'];
$felt="";
$arrIcons=array(
'smallEdit'=>array("href"=>"index.php?option=com_followedlinks&view=linkedit&id=REPLACE", "img"=>IconHelper::getIcon("smallEdit"), "linkjoin"=>"id","alttext"=>"Edit" ),
);
if ($this->auth()==FALSE) die();
if (!isset($_SESSION[$this->pf]['tableorder'])) $_SESSION[$this->pf]['tableorder']='id DESC';
if (isset($se['string']) && trim($se['string'])>"") $felt.=" AND (`name` LIKE '%".trim($se['string'])."%' OR `alias` LIKE '%".trim($se['string'])."%' OR `esem_cont` LIKE '%".trim($se['string'])."%' OR `redirect` LIKE '%".trim($se['string'])."%')";
$cl=($this->getLang()=='hun' ? 'hu-HU' : 'en-GB');
$LANG=parse_ini_file($_SERVER['DOCUMENT_ROOT']."/administrator/language/".$cl."/".$cl.".com_followedlinks.ini");
$objTabla=New TableHelper();
$objTabla->setParams(array('prefix'=>$this->pf,'tablewidth'=>'100%','tablediv'=>'tablediv'));
$v=$objTabla->setSession();
$objTabla->setColumn('id',array('header'=>'Id','width'=>'40px','link'=>'index.php?option=com_followedlinks&view=linkedit&id=REPLACE'));
$objTabla->setColumn('name',array('header'=>$LANG['COM_FOLLOWEDLINKS_NAME'],'format'=>'text','align'=>'left','strlen'=>30,'width'=>'200px','link'=>'index.php?option=com_followedlinks&view=linkedit&id=REPLACE','linkjoin'=>'id'));
$objTabla->setColumn('alias',array('header'=>$LANG['COM_FOLLOWEDLINKS_ALIAS'],'format'=>'text','align'=>'left'));
$objTabla->setColumn('esem_id',array('header'=>str_replace(' ', '<br />', $LANG['COM_FOLLOWEDLINKS_EVENT_NUMBER']),'format'=>'number','decimal'=>0,'width'=>'50px'));
$objTabla->setColumn('esem_cont',array('header'=>$LANG['COM_FOLLOWEDLINKS_EVENT_CONTENT'],'format'=>'text','align'=>'left','strlen'=>30,'width'=>'200px'));
$objTabla->setColumn('redirect',array('header'=>$LANG['COM_FOLLOWEDLINKS_REDIRECT'],'format'=>'text','align'=>'left'));
$objTabla->setColumn('options',array('header'=>$LANG['COM_FOLLOWEDLINKS_OPTIONS'],'align'=>'right','width'=>'60px','order'=>false,'addicons'=>$arrIcons,'linkjoin'=>'id'));
$objTabla->setQuery(array("
SELECT id,name,alias,esem_id,esem_cont,REPLACE(REPLACE(`redirect`,'http://www.archline.hu',''),'http://www.archlinexp.com','') AS redirect,'smallEdit' AS options
FROM followed_links
WHERE `lang`='".$this->getLang()."' ".$felt
.((isset($v['tableorder']) and $v['tableorder']>'') ? ' ORDER BY '.$v['tableorder'] : '')
.((isset($v['tableipp'])) ? ' LIMIT '.($v['tableipp']>0 ? ($v['tablepage']-1)*$v['tableipp'] : 0) .','.$v['tableipp'] : ''),"
SELECT COUNT(*) AS recordCount
FROM (
SELECT *
FROM followed_links
WHERE `lang`='".$this->getLang()."' ".$felt."
) x"
));
// $this->printSession($this->pf);
// print "<pre>".print_r($_SESSION,true)."</pre>";
$objTabla->drawTable(TRUE);
}
public function auth()
{
MySqlHelper::getInstance()->query("
(SELECT * FROM jml_session where session_id='".trim(addslashes($_POST['sess']))."' LIMIT 1)
UNION
(SELECT * FROM eng_session where session_id='".trim(addslashes($_POST['sess']))."' LIMIT 1);");
$sess=MySqlHelper::getInstance()->fetchAssoc();
if (count($sess))
{
MySqlHelper::getInstance()->query("SELECT * FROM jml_user_usergroup_map where group_id IN (7,8) AND user_id=".$sess[0]['userid'].";");
$admin=MySqlHelper::getInstance()->fetchAssoc();
return (count($admin) ? TRUE : FALSE);
}
else
{
return(FALSE);
}
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=(strpos( $_SERVER['HTTP_HOST'], ".com") ? "eng" : "hun"); }
return $this->lang;
}
} // end of class
$controller=new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value','');
jQuery("#string").attr('value','<?=$_SESSION[$controller->pf]["_POST"]["string"]?>');
</script>

View File

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Followedlinks</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>July 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.6</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Followedlinks component ...</description>
<administration>
<!-- Administration Menu Section -->
<menu>COM_FOLLOWEDLINKS_FOLLOWEDLINKS</menu>
<submenu>
<menu link="option=com_followedlinks">COM_FOLLOWEDLINKS_CONTROL_PANEL</menu>
<menu link="option=com_followedlinks&amp;view=links">COM_FOLLOWEDLINKS_FOLLOWEDLINKS</menu>
</submenu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /admin/ in the package -->
<files folder="admin">
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>followedlinks.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="admin/language">
<language tag="hu-HU">hu-HU.com_followedlinks.ini</language>
<language tag="hu-HU">hu-HU.com_followedlinks.sys.ini</language>
<language tag="en-GB">en-GB.com_followedlinks.ini</language>
<language tag="en-GB">en-GB.com_followedlinks.sys.ini</language>
</languages>
</administration>
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Followedlinks</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>July 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.6</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Followedlinks component ...</description>
<administration>
<!-- Administration Menu Section -->
<menu>COM_FOLLOWEDLINKS_FOLLOWEDLINKS</menu>
<submenu>
<menu link="option=com_followedlinks">COM_FOLLOWEDLINKS_CONTROL_PANEL</menu>
<menu link="option=com_followedlinks&amp;view=links">COM_FOLLOWEDLINKS_FOLLOWEDLINKS</menu>
</submenu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /admin/ in the package -->
<files folder="admin">
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>followedlinks.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="admin/language">
<language tag="hu-HU">hu-HU.com_followedlinks.ini</language>
<language tag="hu-HU">hu-HU.com_followedlinks.sys.ini</language>
<language tag="en-GB">en-GB.com_followedlinks.ini</language>
<language tag="en-GB">en-GB.com_followedlinks.sys.ini</language>
</languages>
</administration>
</extension>

View File

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Nonprofit</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>February 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the nonprofit component ...</description>
<languages folder="language">
<language tag="hu-HU">hu-HU/hu-HU.com_nonprofit.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.com_nonprofit.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.com_nonprofit.ini</language>
<language tag="en-GB">en-GB/en-GB.com_nonprofit.sys.ini</language>
</languages>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package -->
<files folder="site">
<filename>index.html</filename>
<filename>nonprofit.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
</files>
<administration>
</administration>
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Nonprofit</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>February 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the nonprofit component ...</description>
<languages folder="language">
<language tag="hu-HU">hu-HU/hu-HU.com_nonprofit.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.com_nonprofit.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.com_nonprofit.ini</language>
<language tag="en-GB">en-GB/en-GB.com_nonprofit.sys.ini</language>
</languages>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package -->
<files folder="site">
<filename>index.html</filename>
<filename>nonprofit.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
</files>
<administration>
</administration>
</extension>

View File

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Presentation</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>September 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the presentation component ...</description>
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package -->
<!-- Site Language File Copy Section -->
<languages folder="language">
<language tag="hu-HU">hu-HU/hu-HU.com_presentation.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.com_presentation.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.com_presentation.ini</language>
<language tag="en-GB">en-GB/en-GB.com_presentation.sys.ini</language>
</languages>
<files folder="site">
<!-- Site Main File Copy Section -->
<filename>index.html</filename>
<filename>presentation.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
<folder>assets</folder>
</files>
<administration>
</administration>
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Presentation</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>September 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the presentation component ...</description>
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package -->
<!-- Site Language File Copy Section -->
<languages folder="language">
<language tag="hu-HU">hu-HU/hu-HU.com_presentation.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.com_presentation.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.com_presentation.ini</language>
<language tag="en-GB">en-GB/en-GB.com_presentation.sys.ini</language>
</languages>
<files folder="site">
<!-- Site Main File Copy Section -->
<filename>index.html</filename>
<filename>presentation.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
<folder>assets</folder>
</files>
<administration>
</administration>
</extension>

View File

@ -1,62 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Project</name>
<creationDate>July 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<version>0.0.1</version>
<description>COM_PROJECT_DESCRIPTION</description>
<!-- Administration Section -->
<administration>
<!-- Administration Language File Copy Section -->
<languages folder="admin/language">
<language tag="hu-HU">hu-HU.com_project.ini</language>
<language tag="hu-HU">hu-HU.com_project.sys.ini</language>
<language tag="en-GB">en-GB.com_project.ini</language>
<language tag="en-GB">en-GB.com_project.sys.ini</language>
</languages>
<!-- Administration Menu Section -->
<menu>COM_PROJECT_PROJECTS</menu>
<submenu>
<menu link="option=com_project">COM_PROJECT_CONTROL_PANEL</menu>
<menu link="option=com_project&amp;view=projects">COM_PROJECT_PROJECTS</menu>
<menu link="option=com_project&amp;view=types">COM_PROJECT_TYPES</menu>
</submenu>
<!-- Administration Main File Copy Section -->
<files folder="admin">
<filename>index.html</filename>
<filename>project.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
</administration>
<!-- Site Section -->
<files folder="site">
<!-- Site Language File Copy Section -->
<!--languages folder="site/language">
<language tag="hu-HU">hu-HU.com_project.ini</language>
<language tag="hu-HU">hu-HU.com_project.sys.ini</language>
<language tag="en-GB">en-GB.com_project.ini</language>
<language tag="en-GB">en-GB.com_project.sys.ini</language>
</languages-->
<!-- Site Main File Copy Section -->
<filename>index.html</filename>
<filename>project.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>views</folder>
<folder>models</folder>
</files>
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Project</name>
<creationDate>July 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<version>0.0.1</version>
<description>COM_PROJECT_DESCRIPTION</description>
<!-- Administration Section -->
<administration>
<!-- Administration Language File Copy Section -->
<languages folder="admin/language">
<language tag="hu-HU">hu-HU.com_project.ini</language>
<language tag="hu-HU">hu-HU.com_project.sys.ini</language>
<language tag="en-GB">en-GB.com_project.ini</language>
<language tag="en-GB">en-GB.com_project.sys.ini</language>
</languages>
<!-- Administration Menu Section -->
<menu>COM_PROJECT_PROJECTS</menu>
<submenu>
<menu link="option=com_project">COM_PROJECT_CONTROL_PANEL</menu>
<menu link="option=com_project&amp;view=projects">COM_PROJECT_PROJECTS</menu>
<menu link="option=com_project&amp;view=types">COM_PROJECT_TYPES</menu>
</submenu>
<!-- Administration Main File Copy Section -->
<files folder="admin">
<filename>index.html</filename>
<filename>project.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
</administration>
<!-- Site Section -->
<files folder="site">
<!-- Site Language File Copy Section -->
<!--languages folder="site/language">
<language tag="hu-HU">hu-HU.com_project.ini</language>
<language tag="hu-HU">hu-HU.com_project.sys.ini</language>
<language tag="en-GB">en-GB.com_project.ini</language>
<language tag="en-GB">en-GB.com_project.sys.ini</language>
</languages-->
<!-- Site Main File Copy Section -->
<filename>index.html</filename>
<filename>project.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>views</folder>
<folder>models</folder>
</files>
</extension>

View File

@ -1,226 +1,226 @@
<?php
require_once('BaseController.class.php');
class Controller extends BaseController
{
public $pf = 'ProductsController';
public $logoPath = '/public/img/collection/REPLACE/zz_thumb.jpg';
public $filePath = '/public/collection/';
public function procEvent()
{
$lang = $_SERVER['SERVER_NAME'] == 'www.archlinexp.com' ? 'eng' : 'hun';
if (!isset($_SESSION[$this->pf]["_POST"]) || trim($_POST["refresh"]) == "") $_SESSION[$this->pf]["_POST"] = $_POST;
if (isset($_POST['uploadForm']) && !isset($_SESSION[$this->pf]["_POST"][$this->pf . "_tableipp"])) $_SESSION[$this->pf]['_POST'][$this->pf . "_tableipp"] = 5;
if (isset($_POST['uploadForm']) && !isset($_SESSION[$this->pf]["tableipp"])) $_SESSION[$this->pf]["tableipp"] = 5;
$se = &$_SESSION[$this->pf]['_POST'];
$felt = "";
$arrIcons = array(
'smallView' => array("href" => "REPLACE", "img" => IconHelper::getIcon("smallView"), "linkjoin" => "logo", "alttext" => "Preview"),
'smallMissingView' => array("href" => "REPLACE", "img" => IconHelper::getIcon("smallMissingView"), "linkjoin" => "logo", "alttext" => "Preview"),
'smallError' => array("href" => "REPLACE", "img" => IconHelper::getIcon("smallError"), "linkjoin" => "filedir", "alttext" => "Missing"),
'smallEnable' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','disable','tablediv');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','tablediv');}", "img" => IconHelper::getIcon("smallEnable")),
'smallDisable' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','enable','tablediv');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','tablediv');}", 'img' => IconHelper::getIcon("smallDisable")),
'smallDel' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','delete','tablediv');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','tablediv');}", 'img' => IconHelper::getIcon("smallDel")),
'smallEdit' => array("href" => "index.php?option=com_showroom&view=productedit&id=REPLACE", "img" => IconHelper::getIcon("smallEdit"), "linkjoin" => "id", "alttext" => "Edit"),
);
if ($this->auth() == FALSE) die();
// multi-edit
if (isset($_POST['cb']) && is_array($_POST['cb']) && count($_POST['cb']) && (trim($_POST['me_tipus']) > '' || (int)$_POST['me_m_id'] > 0 || (int)$_POST['me_c_id'] > 0 || (int)$_POST['me_subcat'] > 0)) {
foreach ($_POST['cb'] as $k => $v) {
MySqlHelper::getInstance()->query("SELECT * FROM collection2 WHERE o_id=" . (int)$v . " LIMIT 1;");
$orig = MySqlHelper::getInstance()->fetchAssoc();
$orig = $orig[0];
$sql = "UPDATE collection2 SET ";
if (trim($_POST['me_tipus']) > '') $sql .= " tipus='" . trim(addslashes($_POST['me_tipus'])) . "',";
if ((int)$_POST['me_m_id'] > 0) $sql .= " m_id='" . (int)$_POST['me_m_id'] . "',";
if ((int)$_POST['me_c_id'] > 0) $sql .= " c_id='" . (int)$_POST['me_c_id'] . "',";
if ((int)$_POST['me_subcat'] > 0) $sql .= " struct_id='" . (int)$_POST['me_subcat'] . "',";
MySqlHelper::getInstance()->query(substr($sql, 0, -1) . " WHERE o_id=" . (int)$v . " LIMIT 1;");
if ((int)$_POST['me_m_id'] > 0 && $orig['m_id'] != (int)$_POST['me_m_id']) {
MySqlHelper::getInstance()->query("SELECT dir FROM coll2_man WHERE id=" . (int)$orig['m_id'] . " LIMIT 1;");
$from = MySqlHelper::getInstance()->fetchAssoc();
$from = $_SERVER['DOCUMENT_ROOT'] . "/public/img/collection/" . $from[0]['dir'] . "/" . (int)$v;
MySqlHelper::getInstance()->query("SELECT dir FROM coll2_man WHERE id=" . (int)$_POST['me_m_id'] . " LIMIT 1;");
$to = MySqlHelper::getInstance()->fetchAssoc();
$to = $_SERVER['DOCUMENT_ROOT'] . "/public/img/collection/" . $to[0]['dir'] . "/" . (int)$v;
if (is_dir($from) && !is_dir($to)) rename($from, $to);
$from = str_replace("img/", "", $from);
$to = str_replace("img/", "", $to);
if (is_dir($from) && !is_dir($to)) rename($from, $to);
}
}
}
// click-edit (enable/disable)
if (isset($_POST[$this->pf . '_event']) and trim($_POST[$this->pf . '_event']) > '') {
$event = trim(strtolower(addslashes((string)$_POST[$this->pf . '_event'])));
$value = trim(strtolower(addslashes((string)$_POST[$this->pf . '_value'])));
if ((int)$value > 0) {
switch ($event) {
case 'enable': {
MySqlHelper::getInstance()->query("UPDATE collection2 SET deleted=0 WHERE o_id=" . $value);
break;
}
case 'disable': {
MySqlHelper::getInstance()->query("UPDATE collection2 SET deleted=1 WHERE o_id=" . $value);
break;
}
case 'delete': {
MySqlHelper::getInstance()->query("DELETE FROM collection2 WHERE o_id=" . $value . " LIMIT 1;");
break;
}
}
}
}
if (isset($se['oid']) && $se['oid'] > "") {
if (strpos($se['oid'], "-")) {
$reszek = explode("-", $se['oid']);
$felt .= ((int)$reszek[0] < (int)$reszek[1] ? " AND x.o_id>=" . (int)$reszek[0] . " AND x.o_id<=" . (int)$reszek[1] : " AND x.o_id>=" . (int)$reszek[1] . " AND x.o_id<=" . (int)$reszek[0]);
} else {
$felt .= " AND x.o_id=" . (int)$se['oid'];
}
}
if (isset($se['name']) && $se['name'] > "") $felt .= " AND (x.title_" . $lang . " LIKE '%" . trim($se['name']) . "%')";
if (isset($se['tipus']) && trim($se['tipus']) > "") $felt .= " AND x.tipus='" . trim($se['tipus']) . "'";
if (isset($se['m_id']) && (int)$se['m_id'] > 0) $felt .= " AND x.m_id=" . (int)$se['m_id'];
if (isset($se['c_id']) && (int)$se['c_id'] > 0) $felt .= " AND x.c_id=" . (int)$se['c_id'];
if (isset($se['parent']) && (int)$se['parent'] > 0) $felt .= " AND p.`id`=" . (int)$se['parent'];
if (isset($se['subcat']) && (int)$se['subcat'] > 0) $felt .= " AND x.struct_id=" . (int)$se['subcat'];
if (isset($se['deleted']) && (int)$se['deleted'] >= 0) $felt .= " AND x.deleted=" . (int)$se['deleted'];
$objTabla = new TableHelper();
$objTabla->setParams(array('prefix' => $this->pf, 'csvExport' => TRUE, 'csvExportFilename' => 'showroom-products.csv', 'tablewidth' => '100%', 'imagePreview' => true, 'tablediv' => 'tablediv', 'footer' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'ipp' => (isset($_POST['uploadForm']) ? 5 : 500)));
$v = $objTabla->setSession();
$objTabla->setColumn('checkbox', array('visible' => FALSE));
if (isset($_POST['uploadForm'])) {
$objTabla->setColumn('id', array('header' => 'Id', 'width' => '40px', 'format' => 'onclick', 'onclick' => "setSelect('REPLACE');", 'linkjoin' => 'idcid'));
$objTabla->setColumn('title', array('header' => 'Név', 'align' => 'left', 'strlen' => 20, 'format' => 'onclick', 'onclick' => "setSelect('REPLACE');", 'width' => '140px', 'linkjoin' => 'idcid'));
} else {
$objTabla->setColumn('id', array('header' => 'Id', 'width' => '40px', 'link' => 'index.php?option=com_showroom&view=productedit&id=REPLACE'));
$objTabla->setColumn('title', array('header' => 'Név', 'format' => 'text', 'align' => 'left', 'strlen' => 20, 'width' => '140px', 'link' => 'index.php?option=com_showroom&view=productedit&id=REPLACE', 'linkjoin' => 'id'));
}
$objTabla->setColumn('idcid', array('visible' => false));
$objTabla->setColumn('desc', array('visible' => false/*'header'=>'Leírás','format'=>'text','align'=>'left'*/));
$objTabla->setColumn('filedir', array('visible' => false));
$objTabla->setColumn('cat', array('header' => 'Kategória', 'format' => 'text', 'align' => 'left'));
$objTabla->setColumn('subcat', array('header' => 'Alkategória', 'format' => 'text', 'align' => 'left'));
$objTabla->setColumn('tipus', array('header' => 'Tipus', 'format' => 'text', 'align' => 'left', 'strlen' => 14, 'width' => '100px'));
$objTabla->setColumn('manufacture', array('header' => 'Gyártó', 'format' => 'text', 'align' => 'left', 'strlen' => 14, 'width' => '80px'));
$objTabla->setColumn('family', array('header' => 'Termékcsalád', 'format' => 'text', 'align' => 'left', 'strlen' => 14, 'width' => '100px'));
$objTabla->setColumn('datum', array('header' => 'Dátum', 'format' => 'text', 'align' => 'right', 'width' => '70px'));
$objTabla->setColumn('rendelheto', array('visible' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'header' => 'Rend.', 'width' => '50px', 'format' => 'text', 'align' => 'center', 'replacevalues' => array(0 => 'Nem', 1 => 'Igen')));
$objTabla->setColumn('show', array('visible' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'header' => 'Megj.', 'width' => '50px', 'format' => 'number', 'decimal' => 0));
$objTabla->setColumn('down', array('visible' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'header' => 'Letölt', 'width' => '50px', 'format' => 'number', 'decimal' => 0));
$objTabla->setColumn('deleted', array('header' => 'Aktív', 'width' => '50px', 'align' => 'center', 'replacevalues' => array(0 => 'Igen', 1 => 'Nem')));
$objTabla->setColumn('logo', array('visible' => false));
$objTabla->setColumn('options', array('header' => 'Műveletek', 'align' => 'right', 'width' => '120px', 'order' => false, 'addicons' => $arrIcons, 'linkjoin' => 'id'));
$objTabla->setQuery(array(
"
SELECT 'x' AS checkbox,x.`o_id` AS `id`,CONCAT(x.`o_id`,'-',c.`c_id`) AS `idcid`,x.`title_" . $lang . "` AS `title`,t.`name_" . $lang . "` AS `tipus`,p.`parent` AS `cat`,s.`struct_" . $lang . "` AS `subcat`,m.`name` AS `manufacture`,c.`nev_" . $lang . "` AS `family`,DATE(x.`datum`) AS datum,x.`rendelheto`,x.`show`,x.`down`,x.`deleted`,REPLACE('" . $this->logoPath . "','REPLACE',CONCAT(m.`dir`,'/',x.`o_id`)) AS `logo`,CONCAT('{$this->filePath}',m.dir,'/',x.o_id,'/') AS `filedir`,CONCAT('smallError|smallView'" . (isset($_POST['uploadForm']) ? "" : ",'|',IF(x.deleted=1,'smallDisable','smallEnable'),'|','smallEdit','|','smallDel'") . ") AS options
FROM collection2 x
LEFT OUTER JOIN coll2_types t ON t.type=x.tipus
LEFT OUTER JOIN coll2_man m ON m.id=x.m_id
LEFT OUTER JOIN coll2_cat c ON c.c_id=x.c_id
LEFT OUTER JOIN coll2_struct s ON s.id=x.struct_id
LEFT OUTER JOIN (SELECT id,struct_" . $lang . " AS `parent` FROM coll2_struct WHERE parent=id) p ON p.id=s.parent
WHERE 1 " . $felt
. ((isset($v['tableorder']) and $v['tableorder'] > '') ? ' ORDER BY ' . $v['tableorder'] : '')
. ((isset($v['tableipp'])) ? ' LIMIT ' . ($v['tableipp'] > 0 ? ($v['tablepage'] - 1) * $v['tableipp'] : 0) . ',' . $v['tableipp'] : ''),
"
SELECT COUNT(*) AS recordCount,SUM(`show`) AS `show`,SUM(`down`) AS `down`
FROM (
SELECT 'x' AS checkbox,x.`o_id` AS `id`,CONCAT(x.`o_id`,'-',c.`c_id`) AS `idcid`,x.`title_" . $lang . "` AS `title`,t.`name_" . $lang . "` AS `tipus`,p.`parent` AS cat,s.`struct_" . $lang . "` AS `subcat`,m.`name` AS `manufacture`,m.`dir` AS `folder`,c.`nev_" . $lang . "` AS `family`,DATE(x.`datum`) AS datum,x.`rendelheto`,x.`show`,x.`down`,x.`deleted`,REPLACE('" . $this->logoPath . "','REPLACE',CONCAT(m.`dir`,'/',x.`o_id`)) AS `logo`,CONCAT('smallView','|',IF(x.deleted=1,'smallDisable','smallEnable'),'|','smallEdit','|','smallDel') AS options
FROM collection2 x
LEFT OUTER JOIN coll2_types t ON t.type=x.tipus
LEFT OUTER JOIN coll2_man m ON m.id=x.m_id
LEFT OUTER JOIN coll2_cat c ON c.c_id=x.c_id
LEFT OUTER JOIN coll2_struct s ON s.id=x.struct_id
LEFT OUTER JOIN (SELECT id,struct_" . $lang . " AS `parent` FROM coll2_struct WHERE parent=id) p ON p.id=s.parent
WHERE 1 " . $felt . "
) x"
));
// print_r($_SERVER);
// print_r($objTabla->arrQuery);
// $this->printSession($this->pf);
// print "<pre>".print_r($_POST,true)."</pre>";
if ($objTabla->params['csvExport'] == TRUE) {
$csvContent = $objTabla->drawTable(FALSE);
$objTabla->saveCSV($csvContent, $objTabla->params['csvExportFilename']);
}
$objTabla->setColumn('checkbox', array('visible' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'header' => '<a onclick="checkAll();">+</a><br /><a onclick="unCheckAll();">-</a>', 'width' => '20px', 'format' => 'checkbox', 'align' => 'center', 'linkjoin' => 'id', 'order' => false));
$objTabla->setParams(array('csvExport' => FALSE));
$objTabla->drawTable();
}
public function auth()
{
MySqlHelper::getInstance()->query("
(SELECT * FROM jml_session where session_id='" . trim(addslashes($_POST['sess'])) . "' LIMIT 1)
UNION
(SELECT * FROM eng_session where session_id='" . trim(addslashes($_POST['sess'])) . "' LIMIT 1)");
$sess = MySqlHelper::getInstance()->fetchAssoc();
if (count($sess)) {
MySqlHelper::getInstance()->query("SELECT * FROM jml_user_usergroup_map where group_id IN (7,8) AND user_id=" . $sess[0]['userid'] . ";");
$admin = MySqlHelper::getInstance()->fetchAssoc();
return (count($admin) ? TRUE : FALSE);
} else {
return (FALSE);
}
}
} // end of class
//print_r($_SESSION);
$controller = new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value', '');
jQuery("#name").attr('value', '<?= $_SESSION[$controller->pf]["_POST"]["name"] ?>');
jQuery("#oid").attr('value', '<?= $_SESSION[$controller->pf]["_POST"]["oid"] ?>');
jQuery("input[name=deleted]").each(function() {
if (jQuery(this).val() == <?= $_SESSION[$controller->pf]["_POST"]["deleted"] ?>) {
jQuery(this).attr('checked', 'checked');
}
});
jQuery("#tipus option").each(function() {
if (jQuery(this).val() == '<?= $_SESSION[$controller->pf]["_POST"]["tipus"] ?>') {
jQuery(this).attr('selected', 'selected');
}
});
jQuery("#m_id option").each(function() {
if (jQuery(this).val() == <?= (int)$_SESSION[$controller->pf]["_POST"]["m_id"] ?>) {
jQuery(this).attr('selected', 'selected');
}
});
jQuery("#c_id option").each(function() {
if (jQuery(this).val() == <?= (int)$_SESSION[$controller->pf]["_POST"]["c_id"] ?>) {
jQuery(this).attr('selected', 'selected');
}
});
jQuery("#parent option").each(function() {
if (jQuery(this).val() == <?= (int)$_SESSION[$controller->pf]["_POST"]["parent"] ?>) {
jQuery(this).attr('selected', 'selected');
}
});
jQuery("#subcat option").each(function() {
if (jQuery(this).val() == <?= (int)$_SESSION[$controller->pf]["_POST"]["subcat"] ?>) {
jQuery(this).attr('selected', 'selected');
}
});
<?php
require_once('BaseController.class.php');
class Controller extends BaseController
{
public $pf = 'ProductsController';
public $logoPath = '/public/img/collection/REPLACE/zz_thumb.jpg';
public $filePath = '/public/collection/';
public function procEvent()
{
$lang = $_SERVER['SERVER_NAME'] == 'www.archlinexp.com' ? 'eng' : 'hun';
if (!isset($_SESSION[$this->pf]["_POST"]) || trim($_POST["refresh"]) == "") $_SESSION[$this->pf]["_POST"] = $_POST;
if (isset($_POST['uploadForm']) && !isset($_SESSION[$this->pf]["_POST"][$this->pf . "_tableipp"])) $_SESSION[$this->pf]['_POST'][$this->pf . "_tableipp"] = 5;
if (isset($_POST['uploadForm']) && !isset($_SESSION[$this->pf]["tableipp"])) $_SESSION[$this->pf]["tableipp"] = 5;
$se = &$_SESSION[$this->pf]['_POST'];
$felt = "";
$arrIcons = array(
'smallView' => array("href" => "REPLACE", "img" => IconHelper::getIcon("smallView"), "linkjoin" => "logo", "alttext" => "Preview"),
'smallMissingView' => array("href" => "REPLACE", "img" => IconHelper::getIcon("smallMissingView"), "linkjoin" => "logo", "alttext" => "Preview"),
'smallError' => array("href" => "REPLACE", "img" => IconHelper::getIcon("smallError"), "linkjoin" => "filedir", "alttext" => "Missing"),
'smallEnable' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','disable','tablediv');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','tablediv');}", "img" => IconHelper::getIcon("smallEnable")),
'smallDisable' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','enable','tablediv');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','tablediv');}", 'img' => IconHelper::getIcon("smallDisable")),
'smallDel' => array("onclick" => "javascript:if (confirm('Are you sure?')) {setField('','" . $this->pf . "_event','delete','tablediv');setField('" . $this->pf . "','" . $this->pf . "_value','REPLACE','tablediv');}", 'img' => IconHelper::getIcon("smallDel")),
'smallEdit' => array("href" => "index.php?option=com_showroom&view=productedit&id=REPLACE", "img" => IconHelper::getIcon("smallEdit"), "linkjoin" => "id", "alttext" => "Edit"),
);
if ($this->auth() == FALSE) die();
// multi-edit
if (isset($_POST['cb']) && is_array($_POST['cb']) && count($_POST['cb']) && (trim($_POST['me_tipus']) > '' || (int)$_POST['me_m_id'] > 0 || (int)$_POST['me_c_id'] > 0 || (int)$_POST['me_subcat'] > 0)) {
foreach ($_POST['cb'] as $k => $v) {
MySqlHelper::getInstance()->query("SELECT * FROM collection2 WHERE o_id=" . (int)$v . " LIMIT 1;");
$orig = MySqlHelper::getInstance()->fetchAssoc();
$orig = $orig[0];
$sql = "UPDATE collection2 SET ";
if (trim($_POST['me_tipus']) > '') $sql .= " tipus='" . trim(addslashes($_POST['me_tipus'])) . "',";
if ((int)$_POST['me_m_id'] > 0) $sql .= " m_id='" . (int)$_POST['me_m_id'] . "',";
if ((int)$_POST['me_c_id'] > 0) $sql .= " c_id='" . (int)$_POST['me_c_id'] . "',";
if ((int)$_POST['me_subcat'] > 0) $sql .= " struct_id='" . (int)$_POST['me_subcat'] . "',";
MySqlHelper::getInstance()->query(substr($sql, 0, -1) . " WHERE o_id=" . (int)$v . " LIMIT 1;");
if ((int)$_POST['me_m_id'] > 0 && $orig['m_id'] != (int)$_POST['me_m_id']) {
MySqlHelper::getInstance()->query("SELECT dir FROM coll2_man WHERE id=" . (int)$orig['m_id'] . " LIMIT 1;");
$from = MySqlHelper::getInstance()->fetchAssoc();
$from = $_SERVER['DOCUMENT_ROOT'] . "/public/img/collection/" . $from[0]['dir'] . "/" . (int)$v;
MySqlHelper::getInstance()->query("SELECT dir FROM coll2_man WHERE id=" . (int)$_POST['me_m_id'] . " LIMIT 1;");
$to = MySqlHelper::getInstance()->fetchAssoc();
$to = $_SERVER['DOCUMENT_ROOT'] . "/public/img/collection/" . $to[0]['dir'] . "/" . (int)$v;
if (is_dir($from) && !is_dir($to)) rename($from, $to);
$from = str_replace("img/", "", $from);
$to = str_replace("img/", "", $to);
if (is_dir($from) && !is_dir($to)) rename($from, $to);
}
}
}
// click-edit (enable/disable)
if (isset($_POST[$this->pf . '_event']) and trim($_POST[$this->pf . '_event']) > '') {
$event = trim(strtolower(addslashes((string)$_POST[$this->pf . '_event'])));
$value = trim(strtolower(addslashes((string)$_POST[$this->pf . '_value'])));
if ((int)$value > 0) {
switch ($event) {
case 'enable': {
MySqlHelper::getInstance()->query("UPDATE collection2 SET deleted=0 WHERE o_id=" . $value);
break;
}
case 'disable': {
MySqlHelper::getInstance()->query("UPDATE collection2 SET deleted=1 WHERE o_id=" . $value);
break;
}
case 'delete': {
MySqlHelper::getInstance()->query("DELETE FROM collection2 WHERE o_id=" . $value . " LIMIT 1;");
break;
}
}
}
}
if (isset($se['oid']) && $se['oid'] > "") {
if (strpos($se['oid'], "-")) {
$reszek = explode("-", $se['oid']);
$felt .= ((int)$reszek[0] < (int)$reszek[1] ? " AND x.o_id>=" . (int)$reszek[0] . " AND x.o_id<=" . (int)$reszek[1] : " AND x.o_id>=" . (int)$reszek[1] . " AND x.o_id<=" . (int)$reszek[0]);
} else {
$felt .= " AND x.o_id=" . (int)$se['oid'];
}
}
if (isset($se['name']) && $se['name'] > "") $felt .= " AND (x.title_" . $lang . " LIKE '%" . trim($se['name']) . "%')";
if (isset($se['tipus']) && trim($se['tipus']) > "") $felt .= " AND x.tipus='" . trim($se['tipus']) . "'";
if (isset($se['m_id']) && (int)$se['m_id'] > 0) $felt .= " AND x.m_id=" . (int)$se['m_id'];
if (isset($se['c_id']) && (int)$se['c_id'] > 0) $felt .= " AND x.c_id=" . (int)$se['c_id'];
if (isset($se['parent']) && (int)$se['parent'] > 0) $felt .= " AND p.`id`=" . (int)$se['parent'];
if (isset($se['subcat']) && (int)$se['subcat'] > 0) $felt .= " AND x.struct_id=" . (int)$se['subcat'];
if (isset($se['deleted']) && (int)$se['deleted'] >= 0) $felt .= " AND x.deleted=" . (int)$se['deleted'];
$objTabla = new TableHelper();
$objTabla->setParams(array('prefix' => $this->pf, 'csvExport' => TRUE, 'csvExportFilename' => 'showroom-products.csv', 'tablewidth' => '100%', 'imagePreview' => true, 'tablediv' => 'tablediv', 'footer' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'ipp' => (isset($_POST['uploadForm']) ? 5 : 500)));
$v = $objTabla->setSession();
$objTabla->setColumn('checkbox', array('visible' => FALSE));
if (isset($_POST['uploadForm'])) {
$objTabla->setColumn('id', array('header' => 'Id', 'width' => '40px', 'format' => 'onclick', 'onclick' => "setSelect('REPLACE');", 'linkjoin' => 'idcid'));
$objTabla->setColumn('title', array('header' => 'Név', 'align' => 'left', 'strlen' => 20, 'format' => 'onclick', 'onclick' => "setSelect('REPLACE');", 'width' => '140px', 'linkjoin' => 'idcid'));
} else {
$objTabla->setColumn('id', array('header' => 'Id', 'width' => '40px', 'link' => 'index.php?option=com_showroom&view=productedit&id=REPLACE'));
$objTabla->setColumn('title', array('header' => 'Név', 'format' => 'text', 'align' => 'left', 'strlen' => 20, 'width' => '140px', 'link' => 'index.php?option=com_showroom&view=productedit&id=REPLACE', 'linkjoin' => 'id'));
}
$objTabla->setColumn('idcid', array('visible' => false));
$objTabla->setColumn('desc', array('visible' => false/*'header'=>'Leírás','format'=>'text','align'=>'left'*/));
$objTabla->setColumn('filedir', array('visible' => false));
$objTabla->setColumn('cat', array('header' => 'Kategória', 'format' => 'text', 'align' => 'left'));
$objTabla->setColumn('subcat', array('header' => 'Alkategória', 'format' => 'text', 'align' => 'left'));
$objTabla->setColumn('tipus', array('header' => 'Tipus', 'format' => 'text', 'align' => 'left', 'strlen' => 14, 'width' => '100px'));
$objTabla->setColumn('manufacture', array('header' => 'Gyártó', 'format' => 'text', 'align' => 'left', 'strlen' => 14, 'width' => '80px'));
$objTabla->setColumn('family', array('header' => 'Termékcsalád', 'format' => 'text', 'align' => 'left', 'strlen' => 14, 'width' => '100px'));
$objTabla->setColumn('datum', array('header' => 'Dátum', 'format' => 'text', 'align' => 'right', 'width' => '70px'));
$objTabla->setColumn('rendelheto', array('visible' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'header' => 'Rend.', 'width' => '50px', 'format' => 'text', 'align' => 'center', 'replacevalues' => array(0 => 'Nem', 1 => 'Igen')));
$objTabla->setColumn('show', array('visible' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'header' => 'Megj.', 'width' => '50px', 'format' => 'number', 'decimal' => 0));
$objTabla->setColumn('down', array('visible' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'header' => 'Letölt', 'width' => '50px', 'format' => 'number', 'decimal' => 0));
$objTabla->setColumn('deleted', array('header' => 'Aktív', 'width' => '50px', 'align' => 'center', 'replacevalues' => array(0 => 'Igen', 1 => 'Nem')));
$objTabla->setColumn('logo', array('visible' => false));
$objTabla->setColumn('options', array('header' => 'Műveletek', 'align' => 'right', 'width' => '120px', 'order' => false, 'addicons' => $arrIcons, 'linkjoin' => 'id'));
$objTabla->setQuery(array(
"
SELECT 'x' AS checkbox,x.`o_id` AS `id`,CONCAT(x.`o_id`,'-',c.`c_id`) AS `idcid`,x.`title_" . $lang . "` AS `title`,t.`name_" . $lang . "` AS `tipus`,p.`parent` AS `cat`,s.`struct_" . $lang . "` AS `subcat`,m.`name` AS `manufacture`,c.`nev_" . $lang . "` AS `family`,DATE(x.`datum`) AS datum,x.`rendelheto`,x.`show`,x.`down`,x.`deleted`,REPLACE('" . $this->logoPath . "','REPLACE',CONCAT(m.`dir`,'/',x.`o_id`)) AS `logo`,CONCAT('{$this->filePath}',m.dir,'/',x.o_id,'/') AS `filedir`,CONCAT('smallError|smallView'" . (isset($_POST['uploadForm']) ? "" : ",'|',IF(x.deleted=1,'smallDisable','smallEnable'),'|','smallEdit','|','smallDel'") . ") AS options
FROM collection2 x
LEFT OUTER JOIN coll2_types t ON t.type=x.tipus
LEFT OUTER JOIN coll2_man m ON m.id=x.m_id
LEFT OUTER JOIN coll2_cat c ON c.c_id=x.c_id
LEFT OUTER JOIN coll2_struct s ON s.id=x.struct_id
LEFT OUTER JOIN (SELECT id,struct_" . $lang . " AS `parent` FROM coll2_struct WHERE parent=id) p ON p.id=s.parent
WHERE 1 " . $felt
. ((isset($v['tableorder']) and $v['tableorder'] > '') ? ' ORDER BY ' . $v['tableorder'] : '')
. ((isset($v['tableipp'])) ? ' LIMIT ' . ($v['tableipp'] > 0 ? ($v['tablepage'] - 1) * $v['tableipp'] : 0) . ',' . $v['tableipp'] : ''),
"
SELECT COUNT(*) AS recordCount,SUM(`show`) AS `show`,SUM(`down`) AS `down`
FROM (
SELECT 'x' AS checkbox,x.`o_id` AS `id`,CONCAT(x.`o_id`,'-',c.`c_id`) AS `idcid`,x.`title_" . $lang . "` AS `title`,t.`name_" . $lang . "` AS `tipus`,p.`parent` AS cat,s.`struct_" . $lang . "` AS `subcat`,m.`name` AS `manufacture`,m.`dir` AS `folder`,c.`nev_" . $lang . "` AS `family`,DATE(x.`datum`) AS datum,x.`rendelheto`,x.`show`,x.`down`,x.`deleted`,REPLACE('" . $this->logoPath . "','REPLACE',CONCAT(m.`dir`,'/',x.`o_id`)) AS `logo`,CONCAT('smallView','|',IF(x.deleted=1,'smallDisable','smallEnable'),'|','smallEdit','|','smallDel') AS options
FROM collection2 x
LEFT OUTER JOIN coll2_types t ON t.type=x.tipus
LEFT OUTER JOIN coll2_man m ON m.id=x.m_id
LEFT OUTER JOIN coll2_cat c ON c.c_id=x.c_id
LEFT OUTER JOIN coll2_struct s ON s.id=x.struct_id
LEFT OUTER JOIN (SELECT id,struct_" . $lang . " AS `parent` FROM coll2_struct WHERE parent=id) p ON p.id=s.parent
WHERE 1 " . $felt . "
) x"
));
// print_r($_SERVER);
// print_r($objTabla->arrQuery);
// $this->printSession($this->pf);
// print "<pre>".print_r($_POST,true)."</pre>";
if ($objTabla->params['csvExport'] == TRUE) {
$csvContent = $objTabla->drawTable(FALSE);
$objTabla->saveCSV($csvContent, $objTabla->params['csvExportFilename']);
}
$objTabla->setColumn('checkbox', array('visible' => (isset($_POST['uploadForm']) ? FALSE : TRUE), 'header' => '<a onclick="checkAll();">+</a><br /><a onclick="unCheckAll();">-</a>', 'width' => '20px', 'format' => 'checkbox', 'align' => 'center', 'linkjoin' => 'id', 'order' => false));
$objTabla->setParams(array('csvExport' => FALSE));
$objTabla->drawTable();
}
public function auth()
{
MySqlHelper::getInstance()->query("
(SELECT * FROM jml_session where session_id='" . trim(addslashes($_POST['sess'])) . "' LIMIT 1)
UNION
(SELECT * FROM eng_session where session_id='" . trim(addslashes($_POST['sess'])) . "' LIMIT 1)");
$sess = MySqlHelper::getInstance()->fetchAssoc();
if (count($sess)) {
MySqlHelper::getInstance()->query("SELECT * FROM jml_user_usergroup_map where group_id IN (7,8) AND user_id=" . $sess[0]['userid'] . ";");
$admin = MySqlHelper::getInstance()->fetchAssoc();
return (count($admin) ? TRUE : FALSE);
} else {
return (FALSE);
}
}
} // end of class
//print_r($_SESSION);
$controller = new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery("#refresh").attr('value', '');
jQuery("#name").attr('value', '<?= $_SESSION[$controller->pf]["_POST"]["name"] ?>');
jQuery("#oid").attr('value', '<?= $_SESSION[$controller->pf]["_POST"]["oid"] ?>');
jQuery("input[name=deleted]").each(function() {
if (jQuery(this).val() == <?= $_SESSION[$controller->pf]["_POST"]["deleted"] ?>) {
jQuery(this).attr('checked', 'checked');
}
});
jQuery("#tipus option").each(function() {
if (jQuery(this).val() == '<?= $_SESSION[$controller->pf]["_POST"]["tipus"] ?>') {
jQuery(this).attr('selected', 'selected');
}
});
jQuery("#m_id option").each(function() {
if (jQuery(this).val() == <?= (int)$_SESSION[$controller->pf]["_POST"]["m_id"] ?>) {
jQuery(this).attr('selected', 'selected');
}
});
jQuery("#c_id option").each(function() {
if (jQuery(this).val() == <?= (int)$_SESSION[$controller->pf]["_POST"]["c_id"] ?>) {
jQuery(this).attr('selected', 'selected');
}
});
jQuery("#parent option").each(function() {
if (jQuery(this).val() == <?= (int)$_SESSION[$controller->pf]["_POST"]["parent"] ?>) {
jQuery(this).attr('selected', 'selected');
}
});
jQuery("#subcat option").each(function() {
if (jQuery(this).val() == <?= (int)$_SESSION[$controller->pf]["_POST"]["subcat"] ?>) {
jQuery(this).attr('selected', 'selected');
}
});
</script>

View File

@ -1,97 +1,97 @@
<?php
require_once('BaseController.class.php');
class Controller extends BaseController {
public $pf='TypesController';
protected $typePath='/public/showroom/types/REPLACE.png';
public $targetdiv='tablediv';
public function procEvent() {
$lang='hun';
if (isset($_POST) && !empty($_POST)) $_SESSION[$this->pf]["_POST"]=$_POST;
$se=&$_SESSION[$this->pf]['_POST'];
$felt="";
$arrIcons=array(
'smallView'=>array("href"=>"REPLACE","img"=>IconHelper::getIcon("smallView"),"linkjoin"=>"img","alttext"=>"View" ),
'smallMissingView'=>array("href"=>"REPLACE","img"=>IconHelper::getIcon("smallMissingView"),"linkjoin"=>"img","alttext"=>"Missing View" ),
'smallEdit'=>array("href"=>"index.php?option=com_showroom&view=typeedit&id=REPLACE", "img"=>IconHelper::getIcon("smallEdit"), "linkjoin"=>"type","alttext"=>"Edit" ),
'smallDel'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','delete','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}",'img'=>IconHelper::getIcon("smallDel") ),
);
if (isset($_POST[$this->pf.'_event']) and trim($_POST[$this->pf.'_event'])>'')
{
$event=trim(strtolower(addslashes((string)$_POST[$this->pf.'_event'])));
$value=trim(strtolower(addslashes((string)$_POST[$this->pf.'_value'])));
switch ($event)
{
case 'delete' : { MySqlHelper::getInstance()->query("DELETE FROM coll2_types WHERE type='".$value."' LIMIT 1;");break; }
}
}
$objTabla=New TableHelper();
$objTabla->setParams(array('prefix'=>$this->pf,'tablewidth'=>'100%','imagePreview'=>true,'tablediv'=>$this->targetdiv));
$v=$objTabla->setSession();
$objTabla->setColumn('img',array('visible'=>false));
$objTabla->setColumn('type',array('header'=>'Típus','width'=>'100px','link'=>'index.php?option=com_showroom&view=typeedit&id=REPLACE'));
$objTabla->setColumn('type_download',array('header'=>'Letöltési<br />könyvtár','width'=>'100px'));
$objTabla->setColumn('name',array('header'=>'Név','width'=>'150px'));
$objTabla->setColumn('desc',array('header'=>'Leírás','strlen'=>40));
$objTabla->setColumn('filename',array('header'=>'File név','width'=>'100px'));
$objTabla->setColumn('all',array('header'=>'Összes<br />elem','width'=>'80px','format'=>'number','decimal'=>0));
$objTabla->setColumn('active',array('header'=>'Aktiv<br />elem','width'=>'80px','format'=>'number','decimal'=>0));
$objTabla->setColumn('megjelenes',array('header'=>'Megjelenés','width'=>'80px','format'=>'number','decimal'=>0));
$objTabla->setColumn('letoltes',array('header'=>'Letöltés','width'=>'80px','format'=>'number','decimal'=>0));
$objTabla->setColumn('options',array('header'=>'Műveletek','align'=>'right','width'=>'100px','order'=>false,'addicons'=>$arrIcons,'linkjoin'=>'type'));
$objTabla->setQuery(array("
SELECT c.`type`,c.`type_download`,c.`name_".$lang."` AS `name`,c.`desc_".$lang."` AS `desc`,REPLACE('".$this->typePath."','REPLACE',c.`type`) AS `img`,CONCAT(c.`type`,'.png') AS `filename`,IF(`all`.darab>0,`all`.darab,0) AS `all`,IF(`active`.darab>0,`active`.darab,0) AS `active`,`all`.`megjelenes`,`all`.`letoltes`,CONCAT('smallView','|','smallEdit','|','smallDel') AS options
FROM coll2_types c
LEFT OUTER JOIN (
SELECT x.tipus AS tipus,COUNT(*) AS darab,SUM(`show`) AS megjelenes,SUM(`down`) AS letoltes
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
GROUP BY x.tipus
) `all` ON `all`.tipus=c.type
LEFT OUTER JOIN (
SELECT x.tipus AS tipus,COUNT(*) AS darab
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0
GROUP BY x.tipus
) `active` ON `active`.tipus=c.type
WHERE 1 ".$felt
.((isset($v['tableorder']) and $v['tableorder']>'') ? ' ORDER BY '.$v['tableorder'] : '')
.((isset($v['tableipp'])) ? ' LIMIT '.($v['tableipp']>0 ? ($v['tablepage']-1)*$v['tableipp'] : 0) .','.$v['tableipp'] : ''),"
SELECT COUNT(*) AS recordCount,SUM(`all`) AS `all`,SUM(`active`) AS `active`,SUM(`megjelenes`) AS `megjelenes`,SUM(`letoltes`) AS `letoltes`
FROM (
SELECT c.`type`,c.`type_download`,c.`name_".$lang."` AS `name`,c.`desc_".$lang."` AS `desc`,REPLACE('".$this->typePath."','REPLACE',c.`type`) AS `img`,CONCAT(c.`type`,'.png') AS `filename`,IF(`all`.darab>0,`all`.darab,0) AS `all`,IF(`active`.darab>0,`active`.darab,0) AS `active`,`all`.`megjelenes`,`all`.`letoltes`,CONCAT('smallView','|','smallEdit','|','smallDel') AS options
FROM coll2_types c
LEFT OUTER JOIN (
SELECT x.tipus AS tipus,COUNT(*) AS darab,SUM(`show`) AS megjelenes,SUM(`down`) AS letoltes
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
GROUP BY x.tipus
) `all` ON `all`.tipus=c.type
LEFT OUTER JOIN (
SELECT x.tipus AS tipus,COUNT(*) AS darab
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0
GROUP BY x.tipus
) `active` ON `active`.tipus=c.type
WHERE 1 ".$felt."
) z"
));
// $this->printSession($this->pf);
$objTabla->drawTable(TRUE);
}
}
$controller=new Controller();
$controller->run();
<?php
require_once('BaseController.class.php');
class Controller extends BaseController {
public $pf='TypesController';
protected $typePath='/public/showroom/types/REPLACE.png';
public $targetdiv='tablediv';
public function procEvent() {
$lang='hun';
if (isset($_POST) && !empty($_POST)) $_SESSION[$this->pf]["_POST"]=$_POST;
$se=&$_SESSION[$this->pf]['_POST'];
$felt="";
$arrIcons=array(
'smallView'=>array("href"=>"REPLACE","img"=>IconHelper::getIcon("smallView"),"linkjoin"=>"img","alttext"=>"View" ),
'smallMissingView'=>array("href"=>"REPLACE","img"=>IconHelper::getIcon("smallMissingView"),"linkjoin"=>"img","alttext"=>"Missing View" ),
'smallEdit'=>array("href"=>"index.php?option=com_showroom&view=typeedit&id=REPLACE", "img"=>IconHelper::getIcon("smallEdit"), "linkjoin"=>"type","alttext"=>"Edit" ),
'smallDel'=>array("onclick"=>"javascript:if (confirm('Are you sure?')) {setField('','".$this->pf."_event','delete','".$this->targetdiv."');setField('".$this->pf."','".$this->pf."_value','REPLACE','".$this->targetdiv."');}",'img'=>IconHelper::getIcon("smallDel") ),
);
if (isset($_POST[$this->pf.'_event']) and trim($_POST[$this->pf.'_event'])>'')
{
$event=trim(strtolower(addslashes((string)$_POST[$this->pf.'_event'])));
$value=trim(strtolower(addslashes((string)$_POST[$this->pf.'_value'])));
switch ($event)
{
case 'delete' : { MySqlHelper::getInstance()->query("DELETE FROM coll2_types WHERE type='".$value."' LIMIT 1;");break; }
}
}
$objTabla=New TableHelper();
$objTabla->setParams(array('prefix'=>$this->pf,'tablewidth'=>'100%','imagePreview'=>true,'tablediv'=>$this->targetdiv));
$v=$objTabla->setSession();
$objTabla->setColumn('img',array('visible'=>false));
$objTabla->setColumn('type',array('header'=>'Típus','width'=>'100px','link'=>'index.php?option=com_showroom&view=typeedit&id=REPLACE'));
$objTabla->setColumn('type_download',array('header'=>'Letöltési<br />könyvtár','width'=>'100px'));
$objTabla->setColumn('name',array('header'=>'Név','width'=>'150px'));
$objTabla->setColumn('desc',array('header'=>'Leírás','strlen'=>40));
$objTabla->setColumn('filename',array('header'=>'File név','width'=>'100px'));
$objTabla->setColumn('all',array('header'=>'Összes<br />elem','width'=>'80px','format'=>'number','decimal'=>0));
$objTabla->setColumn('active',array('header'=>'Aktiv<br />elem','width'=>'80px','format'=>'number','decimal'=>0));
$objTabla->setColumn('megjelenes',array('header'=>'Megjelenés','width'=>'80px','format'=>'number','decimal'=>0));
$objTabla->setColumn('letoltes',array('header'=>'Letöltés','width'=>'80px','format'=>'number','decimal'=>0));
$objTabla->setColumn('options',array('header'=>'Műveletek','align'=>'right','width'=>'100px','order'=>false,'addicons'=>$arrIcons,'linkjoin'=>'type'));
$objTabla->setQuery(array("
SELECT c.`type`,c.`type_download`,c.`name_".$lang."` AS `name`,c.`desc_".$lang."` AS `desc`,REPLACE('".$this->typePath."','REPLACE',c.`type`) AS `img`,CONCAT(c.`type`,'.png') AS `filename`,IF(`all`.darab>0,`all`.darab,0) AS `all`,IF(`active`.darab>0,`active`.darab,0) AS `active`,`all`.`megjelenes`,`all`.`letoltes`,CONCAT('smallView','|','smallEdit','|','smallDel') AS options
FROM coll2_types c
LEFT OUTER JOIN (
SELECT x.tipus AS tipus,COUNT(*) AS darab,SUM(`show`) AS megjelenes,SUM(`down`) AS letoltes
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
GROUP BY x.tipus
) `all` ON `all`.tipus=c.type
LEFT OUTER JOIN (
SELECT x.tipus AS tipus,COUNT(*) AS darab
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0
GROUP BY x.tipus
) `active` ON `active`.tipus=c.type
WHERE 1 ".$felt
.((isset($v['tableorder']) and $v['tableorder']>'') ? ' ORDER BY '.$v['tableorder'] : '')
.((isset($v['tableipp'])) ? ' LIMIT '.($v['tableipp']>0 ? ($v['tablepage']-1)*$v['tableipp'] : 0) .','.$v['tableipp'] : ''),"
SELECT COUNT(*) AS recordCount,SUM(`all`) AS `all`,SUM(`active`) AS `active`,SUM(`megjelenes`) AS `megjelenes`,SUM(`letoltes`) AS `letoltes`
FROM (
SELECT c.`type`,c.`type_download`,c.`name_".$lang."` AS `name`,c.`desc_".$lang."` AS `desc`,REPLACE('".$this->typePath."','REPLACE',c.`type`) AS `img`,CONCAT(c.`type`,'.png') AS `filename`,IF(`all`.darab>0,`all`.darab,0) AS `all`,IF(`active`.darab>0,`active`.darab,0) AS `active`,`all`.`megjelenes`,`all`.`letoltes`,CONCAT('smallView','|','smallEdit','|','smallDel') AS options
FROM coll2_types c
LEFT OUTER JOIN (
SELECT x.tipus AS tipus,COUNT(*) AS darab,SUM(`show`) AS megjelenes,SUM(`down`) AS letoltes
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
GROUP BY x.tipus
) `all` ON `all`.tipus=c.type
LEFT OUTER JOIN (
SELECT x.tipus AS tipus,COUNT(*) AS darab
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0
GROUP BY x.tipus
) `active` ON `active`.tipus=c.type
WHERE 1 ".$felt."
) z"
));
// $this->printSession($this->pf);
$objTabla->drawTable(TRUE);
}
}
$controller=new Controller();
$controller->run();
?>

View File

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Showroom</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>April 2017</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.1.0</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Showroom component ...</description>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package -->
<files folder="site">
<language tag="hu-HU">language/hu-HU.com_showroom.ini</language>
<language tag="en-GB">language/en-GB.com_showroom.ini</language>
<filename>index.html</filename>
<filename>router.php</filename>
<filename>showroom.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
<folder>assets</folder>
</files>
<administration>
<!-- Administration Menu Section -->
<menu>Showroom</menu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /admin/ in the package -->
<files folder="admin">
<language tag="hu-HU">language/hu-HU.com_showroom.ini</language>
<language tag="en-GB">language/en-GB.com_showroom.ini</language>
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>showroom.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
</administration>
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Showroom</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>April 2017</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.1.0</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Showroom component ...</description>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package -->
<files folder="site">
<language tag="hu-HU">language/hu-HU.com_showroom.ini</language>
<language tag="en-GB">language/en-GB.com_showroom.ini</language>
<filename>index.html</filename>
<filename>router.php</filename>
<filename>showroom.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
<folder>assets</folder>
</files>
<administration>
<!-- Administration Menu Section -->
<menu>Showroom</menu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /admin/ in the package -->
<files folder="admin">
<language tag="hu-HU">language/hu-HU.com_showroom.ini</language>
<language tag="en-GB">language/en-GB.com_showroom.ini</language>
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>showroom.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
</administration>
</extension>

View File

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Tcexam</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>June 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Tcexam component ...</description>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package -->
<files folder="site">
<filename>index.html</filename>
<filename>tcexam.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
</files>
<administration>
</administration>
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Tcexam</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>June 2015</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Tcexam component ...</description>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package -->
<files folder="site">
<filename>index.html</filename>
<filename>tcexam.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
</files>
<administration>
</administration>
</extension>

View File

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Versions</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>January 2016</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.6</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Versions component ...</description>
<administration>
<!-- Administration Menu Section -->
<menu>COM_VERSIONS_VERSIONS</menu>
<submenu>
<menu link="option=com_versions">COM_VERSIONS_CONTROL_PANEL</menu>
<menu link="option=com_versions&amp;view=list">COM_VERSIONS_VERSIONS</menu>
</submenu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /admin/ in the package -->
<files folder="admin">
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>versions.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="admin/language">
<language tag="hu-HU">hu-HU.com_versions.ini</language>
<language tag="hu-HU">hu-HU.com_versions.sys.ini</language>
<language tag="en-GB">en-GB.com_versions.ini</language>
<language tag="en-GB">en-GB.com_versions.sys.ini</language>
</languages>
</administration>
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>Versions</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>January 2016</creationDate>
<author>Fekete Zsolt</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>http://www.facebook.com/mcleod78</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.6</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Versions component ...</description>
<administration>
<!-- Administration Menu Section -->
<menu>COM_VERSIONS_VERSIONS</menu>
<submenu>
<menu link="option=com_versions">COM_VERSIONS_CONTROL_PANEL</menu>
<menu link="option=com_versions&amp;view=list">COM_VERSIONS_VERSIONS</menu>
</submenu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /admin/ in the package -->
<files folder="admin">
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>versions.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="admin/language">
<language tag="hu-HU">hu-HU.com_versions.ini</language>
<language tag="hu-HU">hu-HU.com_versions.sys.ini</language>
<language tag="en-GB">en-GB.com_versions.ini</language>
<language tag="en-GB">en-GB.com_versions.sys.ini</language>
</languages>
</administration>
</extension>

View File

@ -1,413 +1,413 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class NonprofitModelNonprofit extends JModelItem
{
public $npRangeMin=990001;
public $npRangeMax=999999;
protected $prefix;
protected $article;
public $hasNonprofitProgram;
public $hasCommercial;
public $isNonprofitConnectedToThisComputer;
public $isConnectedNonprofitExpired;
protected $existKeys;
protected $freeKeys;
protected $crmUser;
protected $dbCRM;
public $newPass;
public $newKey;
public $sqlQuery; //debugra!
public function getConfig()
{
if (empty($this->dbCRM))
{
require($_SERVER['DOCUMENT_ROOT'].'/maintenance/config.crm.php');
$this->dbCRM=$dbCRM;
}
return($this->dbCRM);
}
public function getPrefix($nUserID=0)
{
if ((int)$nUserID>0)
{
if (!isset($this->prefix))
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `users` WHERE nUserID=".$nUserID.";");
$tmp=$crm->loadObjectList();
$this->prefix=($tmp[0]->old_db=='clusers' ? 'jml' : 'eng');
}
}
else
{
$this->prefix='eng';
}
return $this->prefix;
}
public function getCurrentVersion($field='verID')
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT ".$field." AS verID FROM `p_versions` WHERE verActual='Y' LIMIT 1;");
$tmp=$crm->loadObjectList();
return ($tmp[0]->verID);
}
public function getArticle($product=1)
{
if (!isset($this->article))
{
$db=JFactory::getDBO();
if($product == 1){
$db->setQuery("SELECT * FROM #__content WHERE alias='nonprofit' LIMIT 1;");
} else {
$db->setQuery("SELECT * FROM #__content WHERE alias='nonprofitlive' LIMIT 1;");
}
$tmp=$db->loadObjectList();
$this->article=$tmp[0];
}
return $this->article;
}
public function syncUser()
{
$db=JFactory::getDBO();
$user=JFactory::getUser();
$session=JFactory::getSession();
file_get_contents("http://www.archline.hu/maintenance/sync_user.php");
file_get_contents("http://www.archline.hu/maintenance/sync_download.php?jmdb=jml");
file_get_contents("http://www.archline.hu/maintenance/sync_download.php?jmdb=eng");
$db->setQuery("SELECT * FROM #__users WHERE id=".$user->id." LIMIT 1;");
$curr=$db->loadObjectList();
$tmpUser=$session->get('user');
$tmpUser->nUserID=$curr[0]->nUserID;
$session->set('user', $tmpUser);
}
public function getCRMUser($nUserID=0)
{
if ($nUserID>0 && !isset($this->crmUser))
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `users` WHERE nUserID=".$nUserID." LIMIT 1;");
$tmp=$crm->loadObjectList();
if (!empty($tmp))
{
$this->crmUser=$tmp[0];
}
}
return $this->crmUser;
}
public function hasRecord($nUserID=0, $product=1, $npid="")
{
if ($nUserID==0)
{
$this->hasNonprofitProgram=FALSE;
$this->hasCommercial=FALSE;
$this->isNonprofitConnectedToThisComputer=FALSE;
$this->isConnectedNonprofitExpired=TRUE;
}
else
{
$verid = /*$this->getCurrentVersion('verID')*/ 19; // EZT KI KELL VENNI MARCIUSBAN!!!!
if (!isset($this->hasNonprofitProgram))
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM hardlock h
LEFT OUTER JOIN h_programs p ON h.hlNum = p.prHlNum
WHERE h.product_id=".$product." AND h.hlUser=".$nUserID." AND p.prVerID=".$verid." AND p.prHlNum LIKE '99%'");
$tmp=$crm->loadObjectList();
if (count($tmp))
{
$this->hasNonprofitProgram=TRUE;
$this->existKeys=$tmp;
}
else
{
$this->hasNonprofitProgram=FALSE;
}
}
if (!isset($this->hasCommercial))
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM hardlock h
LEFT OUTER JOIN `h_programs` p ON h.hlNum=p.prHlNum
WHERE h.product_id=".$product." AND h.hlNum not like '99%' AND h.hlUser=".$nUserID." AND p.prVerID=".$verid);
$tmp=$crm->loadObjectList();
if (count($tmp))
{
$this->hasCommercial=TRUE;
}
else
{
$this->hasCommercial=FALSE;
}
}
if (!isset($this->isNonprofitConnectedToThisComputer) && $this->hasNonprofitProgram)
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp2=$crm->loadObjectList();
if(empty($tmp2)) {
$rec23=new stdClass();
$rec23->computer_id = $npid;
$rec23->last_mod = date('Y-m-d',time());
$result23=$crm->insertObject("computers", $rec23);
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp2=$crm->loadObjectList();
}
$comp=$tmp2[0];
$verPassword8and9 = /*$this->getCurrentVersion('verPassword8and9')*/ 36; // EZT KI KELL VENNI MARCIUSBAN!!!!
$query = "SELECT h_programs.prFizetve AS expire_datetime
FROM `nonprofit`
LEFT OUTER JOIN hardlock ON hardlock.hlNum = nonprofit.hlID
LEFT OUTER JOIN h_programs ON h_programs.prHlNum = nonprofit.hlID
WHERE nonprofit.computer_id='".$comp->id."' AND nonprofit.verid=".$verPassword8and9." AND h_programs.prVerID=".$verid." AND nonprofit.partnerID is null AND hardlock.product_id='".$product."';";
$crm->setQuery($query);
$tmp=$crm->loadObjectList();
$this->isNonprofitConnectedToThisComputer=(count($tmp) ? TRUE : FALSE);
if($this->isNonprofitConnectedToThisComputer) {
$expireDateTime=$tmp[0]->expire_datetime;
$this->isConnectedNonprofitExpired = $expireDateTime < date("Y-m-d H:i:s", time());
} else {
$this->isConnectedNonprofitExpired=TRUE;
}
} else {
$this->isNonprofitConnectedToThisComputer=FALSE;
$this->isConnectedNonprofitExpired=TRUE;
}
}
$this->haveRightsToUseNonprofit = !$this->hasCommercial && (!$this->hasNonprofitProgram || !$this->isConnectedNonprofitExpired);
$this->hasToGenerateNonprofit = $this->haveRightsToUseNonprofit && !$this->hasNonprofitProgram;
}
public function getExistingKeyAndPass($nUserID=0,$npid="",$verid=0, $product=1) {
if ((int)$verid==0) $verid = /*$this->getCurrentVersion('verID')*/ 19; // EZT KI KELL VENNI MARCIUSBAN!!!!
if ($nUserID>0 && $npid>"") {
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp=$crm->loadObjectList();
$comp=$tmp[0];
$query="SELECT h_programs.prHlNum AS nonprofitKey, h_programs.prPass AS nonprofitPassword FROM nonprofit
LEFT OUTER JOIN hardlock ON hardlock.hlNum = nonprofit.hlID
LEFT OUTER JOIN h_programs ON h_programs.prHlNum = nonprofit.hlID
WHERE nonprofit.computer_id='".$comp->id."' AND nonprofit.verid=".(int)$verid." AND nonprofit.nUserID='".$nUserID."' AND nonprofit.partnerID is null AND hardlock.product_id='".$product."';";
$this->sqlQuery=$query;
$crm->setQuery($query);
$tmp2=$crm->loadObjectList();
$nonp=$tmp2[0];
}
$this->newKey=$nonp->nonprofitKey;
$this->newPass=$nonp->nonprofitPassword;
}
public function getKey($nUserID=0,$npid="",$isid="",$verid=0, $product=1)
{
$newKey=0;
if ((int)$verid==0) $verid = /*$this->getCurrentVersion('verID')*/ 19; // EZT KI KELL VENNI MARCIUSBAN!!!!
if ($nUserID>0 && $npid>"")
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp2=$crm->loadObjectList();
if(empty($tmp2)){
$rec23=new stdClass();
$rec23->computer_id = $npid;
$rec23->last_mod = date('Y-m-d',time());
$result23=$crm->insertObject("computers", $rec23);
}
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp3=$crm->loadObjectList();
$comp=$tmp3[0];
$crm->setQuery("SELECT * FROM `nonprofit`
LEFT JOIN hardlock ON hardlock.hlNum = nonprofit.hlID
WHERE nonprofit.computer_id='".$comp->id."' AND nonprofit.verid='".$verid."' AND nonprofit.`partnerID` is null AND hardlock.product_id=".$product.";");
$tmp=$crm->loadObjectList();
if (empty($tmp))
{
$crm->setQuery("SELECT * FROM `users` WHERE nUserID=".$nUserID.";");
$tmp=$crm->loadObjectList();
$user=$tmp[0];
$newKey=(int)$this->tryToAlloc($this->npRangeMin,$this->npRangeMax);
if ($newKey>0 && !empty($user))
{
$rec=new stdClass();
$rec->hlNum=$newKey;
// $rec->hlCtrID=$user->nCtrID;
$rec->hlCtrID=($user->old_db=='clusers' ? 36 : 44);
$rec->hlLan=0;
$rec->hlStat=1;
$rec->hlDateIssue=date('Y-m-d',time());
$rec->hlManID=36;
$rec->hlTime=date('Y-m-d H:i:s',time());
$rec->hlUser=$nUserID;
$rec->hlDealer=($user->old_db=='clusers' ? 51850 : 51851);
$rec->bUjithato=1;
$rec->old_db=$user->old_db;
$rec->product_id=$product;
$crm->setQuery("SELECT * FROM `hardlock` WHERE hlNum=".$newKey." AND product_id=".$product." ORDER BY hlID DESC LIMIT 1;");
$tmp=$crm->loadObjectList();
$exist=$tmp[0];
if ($exist)
{
$values=array();
$query=$crm->getQuery(true);
foreach ((array)$rec as $k=>$v) $values[]=$crm->quoteName($k)."=".$crm->quote($v);
$query->update("hardlock")->set($values)->where(array('`hlID`='.(int)$exist->hlID));
$crm->setQuery($query);
$result=$crm->execute();
//if ($_SERVER['REMOTE_ADDR']=='46.139.14.111') {print_r($exist); print('<br />haha<br />'.$newKey); die();}
}
else
{
$result=$crm->insertObject("hardlock", $rec);
}
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp233=$crm->loadObjectList();
$comp2=$tmp233[0];
$rec2=new stdClass();
$rec2->computer_id=$comp2->id;
$rec2->isid=$isid;
$rec2->verid=$verid;
$rec2->hlID=$newKey;
$rec2->nUserID=$nUserID;
$rec2->add_datetime=date('Y-m-d H:i:s',time());
$rec2->expire_datetime=date('Y-m-d',time()+60*86400).' 23:59:59';
$rec2->old_db=$user->old_db;
$result2=$crm->insertObject("nonprofit", $rec2);
$rec=new stdClass();
$rec->nUserID=$nUserID;
$rec->nTopicID=($user->old_db=='clusers' ? 300 : 302); //($this->getPrefix()=='jml' ? 300 : 302);
$rec->dateEvent=date('Y-m-d',time());
$rec->strPlace='web';
$rec->strInfo=JText::sprintf("COM_NONPROFIT_KEY_REQUEST_INFO",$newKey);
$rec->nManagerID=36;
$rec->insertDate=date('Y-m-d H:i:s',time());
$result=$crm->insertObject("u_history", $rec);
}
}
}
return ($newKey);
}
public function getPass($nUserID=0,$npid="",$isid="",$verid=0, $product=1)
{
$res="";
if ($npid>"" && $isid>"" && (int)$verid>0)
{
$res=file_get_contents("https://www.archlinexp.com/maintenance/nonprofit.php?npid=".$npid."&isid=".$isid."&verid=".(int)$verid."&createProgram=true&product=".$product);
}
return ($res);
}
/*******************************************************************************
* Megpróbálja az adott kulcs tartományon belül a lehető legkissebb szabad
* kulcsot megtalálni, és visszaadja az számát
******************************************************************************/
public function tryToAlloc($min=0,$max=0)
{
$ret=0;
if ((int)$min==0 || (int)$max==0) return($ret);
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT LEFT(hlNum,6) AS hlNum FROM hardlock WHERE hlStat!=0 AND hlNum>=".(int)$min." AND hlNum<".(int)$max." ORDER BY hlNum;");
$res=$crm->loadObjectList();
if (count($res))
{
$keszlet=range($min, $max);
foreach ($res as $r) { $kulcsok[]=$r->hlNum; }
$diff=array_diff($keszlet,$kulcsok);
reset($diff);
$ret=current($diff);
if ((int)$ret>0)
{
$crm->setQuery("DELETE FROM `t_registeronce` WHERE arch_id=".(int)$ret);
$crm->execute();
}
$this->freeKeys=count($diff)-1;
}
return $ret;
}
public function countFreeKeys($min=0,$max=0)
{
$this->tryToAlloc($min,$max);
return ((int)$this->freeKeys);
}
public function sendWarningMail()
{
$app=JFactory::getApplication();
$config=JFactory::getConfig();
$mailer=JFactory::getMailer();
$mailer->setSender(array('info@cadline.hu'));
$mailer->addRecipient(array('office@cadline.hu', 'marketing@cadline.hu'));
$mailer->setSubject(JText::_(($this->freeKeys==0 ? 'COM_NONPROFIT_MAIL_NO_KEY_SUBJECT' : 'COM_NONPROFIT_MAIL_KEY_LOW_SUBJECT')));
$mailer->setBody(JText::sprintf(($this->freeKeys==0 ? 'COM_NONPROFIT_MAIL_NO_KEY_BODY' : 'COM_NONPROFIT_MAIL_KEY_LOW_BODY'),$this->freeKeys));
$mailer->Send();
}
public function sendPasswordInEmail($to, $user, $password, $product)
{
$app=JFactory::getApplication();
$config=JFactory::getConfig();
$mailer=JFactory::getMailer();
$mailer->isHTML(true);
$mailer->setSender(array('info@cadline.hu'));
$mailer->addRecipient(array($to));
if($product == 2) {
$mailer->setSubject("Non-Profit - ARCHLine.XP Live");
$mailer->setBody(JText::sprintf('COM_NONPROFIT_EMAIL_BODY_LIVE', $user, $password));
} else {
$mailer->setSubject("Non-Profit - ARCHLine.XP");
$mailer->setBody(JText::sprintf('COM_NONPROFIT_EMAIL_BODY', $user, $password));
}
$mailer->Send();
}
public function getExistKeys() { return ($this->existKeys); }
public function getLang()
{
return (JFactory::getLanguage()->getTag()=='hu-HU' ? "hun" : "eng");
}
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class NonprofitModelNonprofit extends JModelItem
{
public $npRangeMin=990001;
public $npRangeMax=999999;
protected $prefix;
protected $article;
public $hasNonprofitProgram;
public $hasCommercial;
public $isNonprofitConnectedToThisComputer;
public $isConnectedNonprofitExpired;
protected $existKeys;
protected $freeKeys;
protected $crmUser;
protected $dbCRM;
public $newPass;
public $newKey;
public $sqlQuery; //debugra!
public function getConfig()
{
if (empty($this->dbCRM))
{
require($_SERVER['DOCUMENT_ROOT'].'/maintenance/config.crm.php');
$this->dbCRM=$dbCRM;
}
return($this->dbCRM);
}
public function getPrefix($nUserID=0)
{
if ((int)$nUserID>0)
{
if (!isset($this->prefix))
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `users` WHERE nUserID=".$nUserID.";");
$tmp=$crm->loadObjectList();
$this->prefix=($tmp[0]->old_db=='clusers' ? 'jml' : 'eng');
}
}
else
{
$this->prefix='eng';
}
return $this->prefix;
}
public function getCurrentVersion($field='verID')
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT ".$field." AS verID FROM `p_versions` WHERE verActual='Y' LIMIT 1;");
$tmp=$crm->loadObjectList();
return ($tmp[0]->verID);
}
public function getArticle($product=1)
{
if (!isset($this->article))
{
$db=JFactory::getDBO();
if($product == 1){
$db->setQuery("SELECT * FROM #__content WHERE alias='nonprofit' LIMIT 1;");
} else {
$db->setQuery("SELECT * FROM #__content WHERE alias='nonprofitlive' LIMIT 1;");
}
$tmp=$db->loadObjectList();
$this->article=$tmp[0];
}
return $this->article;
}
public function syncUser()
{
$db=JFactory::getDBO();
$user=JFactory::getUser();
$session=JFactory::getSession();
file_get_contents("http://www.archline.hu/maintenance/sync_user.php");
file_get_contents("http://www.archline.hu/maintenance/sync_download.php?jmdb=jml");
file_get_contents("http://www.archline.hu/maintenance/sync_download.php?jmdb=eng");
$db->setQuery("SELECT * FROM #__users WHERE id=".$user->id." LIMIT 1;");
$curr=$db->loadObjectList();
$tmpUser=$session->get('user');
$tmpUser->nUserID=$curr[0]->nUserID;
$session->set('user', $tmpUser);
}
public function getCRMUser($nUserID=0)
{
if ($nUserID>0 && !isset($this->crmUser))
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `users` WHERE nUserID=".$nUserID." LIMIT 1;");
$tmp=$crm->loadObjectList();
if (!empty($tmp))
{
$this->crmUser=$tmp[0];
}
}
return $this->crmUser;
}
public function hasRecord($nUserID=0, $product=1, $npid="")
{
if ($nUserID==0)
{
$this->hasNonprofitProgram=FALSE;
$this->hasCommercial=FALSE;
$this->isNonprofitConnectedToThisComputer=FALSE;
$this->isConnectedNonprofitExpired=TRUE;
}
else
{
$verid = /*$this->getCurrentVersion('verID')*/ 19; // EZT KI KELL VENNI MARCIUSBAN!!!!
if (!isset($this->hasNonprofitProgram))
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM hardlock h
LEFT OUTER JOIN h_programs p ON h.hlNum = p.prHlNum
WHERE h.product_id=".$product." AND h.hlUser=".$nUserID." AND p.prVerID=".$verid." AND p.prHlNum LIKE '99%'");
$tmp=$crm->loadObjectList();
if (count($tmp))
{
$this->hasNonprofitProgram=TRUE;
$this->existKeys=$tmp;
}
else
{
$this->hasNonprofitProgram=FALSE;
}
}
if (!isset($this->hasCommercial))
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM hardlock h
LEFT OUTER JOIN `h_programs` p ON h.hlNum=p.prHlNum
WHERE h.product_id=".$product." AND h.hlNum not like '99%' AND h.hlUser=".$nUserID." AND p.prVerID=".$verid);
$tmp=$crm->loadObjectList();
if (count($tmp))
{
$this->hasCommercial=TRUE;
}
else
{
$this->hasCommercial=FALSE;
}
}
if (!isset($this->isNonprofitConnectedToThisComputer) && $this->hasNonprofitProgram)
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp2=$crm->loadObjectList();
if(empty($tmp2)) {
$rec23=new stdClass();
$rec23->computer_id = $npid;
$rec23->last_mod = date('Y-m-d',time());
$result23=$crm->insertObject("computers", $rec23);
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp2=$crm->loadObjectList();
}
$comp=$tmp2[0];
$verPassword8and9 = /*$this->getCurrentVersion('verPassword8and9')*/ 36; // EZT KI KELL VENNI MARCIUSBAN!!!!
$query = "SELECT h_programs.prFizetve AS expire_datetime
FROM `nonprofit`
LEFT OUTER JOIN hardlock ON hardlock.hlNum = nonprofit.hlID
LEFT OUTER JOIN h_programs ON h_programs.prHlNum = nonprofit.hlID
WHERE nonprofit.computer_id='".$comp->id."' AND nonprofit.verid=".$verPassword8and9." AND h_programs.prVerID=".$verid." AND nonprofit.partnerID is null AND hardlock.product_id='".$product."';";
$crm->setQuery($query);
$tmp=$crm->loadObjectList();
$this->isNonprofitConnectedToThisComputer=(count($tmp) ? TRUE : FALSE);
if($this->isNonprofitConnectedToThisComputer) {
$expireDateTime=$tmp[0]->expire_datetime;
$this->isConnectedNonprofitExpired = $expireDateTime < date("Y-m-d H:i:s", time());
} else {
$this->isConnectedNonprofitExpired=TRUE;
}
} else {
$this->isNonprofitConnectedToThisComputer=FALSE;
$this->isConnectedNonprofitExpired=TRUE;
}
}
$this->haveRightsToUseNonprofit = !$this->hasCommercial && (!$this->hasNonprofitProgram || !$this->isConnectedNonprofitExpired);
$this->hasToGenerateNonprofit = $this->haveRightsToUseNonprofit && !$this->hasNonprofitProgram;
}
public function getExistingKeyAndPass($nUserID=0,$npid="",$verid=0, $product=1) {
if ((int)$verid==0) $verid = /*$this->getCurrentVersion('verID')*/ 19; // EZT KI KELL VENNI MARCIUSBAN!!!!
if ($nUserID>0 && $npid>"") {
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp=$crm->loadObjectList();
$comp=$tmp[0];
$query="SELECT h_programs.prHlNum AS nonprofitKey, h_programs.prPass AS nonprofitPassword FROM nonprofit
LEFT OUTER JOIN hardlock ON hardlock.hlNum = nonprofit.hlID
LEFT OUTER JOIN h_programs ON h_programs.prHlNum = nonprofit.hlID
WHERE nonprofit.computer_id='".$comp->id."' AND nonprofit.verid=".(int)$verid." AND nonprofit.nUserID='".$nUserID."' AND nonprofit.partnerID is null AND hardlock.product_id='".$product."';";
$this->sqlQuery=$query;
$crm->setQuery($query);
$tmp2=$crm->loadObjectList();
$nonp=$tmp2[0];
}
$this->newKey=$nonp->nonprofitKey;
$this->newPass=$nonp->nonprofitPassword;
}
public function getKey($nUserID=0,$npid="",$isid="",$verid=0, $product=1)
{
$newKey=0;
if ((int)$verid==0) $verid = /*$this->getCurrentVersion('verID')*/ 19; // EZT KI KELL VENNI MARCIUSBAN!!!!
if ($nUserID>0 && $npid>"")
{
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp2=$crm->loadObjectList();
if(empty($tmp2)){
$rec23=new stdClass();
$rec23->computer_id = $npid;
$rec23->last_mod = date('Y-m-d',time());
$result23=$crm->insertObject("computers", $rec23);
}
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp3=$crm->loadObjectList();
$comp=$tmp3[0];
$crm->setQuery("SELECT * FROM `nonprofit`
LEFT JOIN hardlock ON hardlock.hlNum = nonprofit.hlID
WHERE nonprofit.computer_id='".$comp->id."' AND nonprofit.verid='".$verid."' AND nonprofit.`partnerID` is null AND hardlock.product_id=".$product.";");
$tmp=$crm->loadObjectList();
if (empty($tmp))
{
$crm->setQuery("SELECT * FROM `users` WHERE nUserID=".$nUserID.";");
$tmp=$crm->loadObjectList();
$user=$tmp[0];
$newKey=(int)$this->tryToAlloc($this->npRangeMin,$this->npRangeMax);
if ($newKey>0 && !empty($user))
{
$rec=new stdClass();
$rec->hlNum=$newKey;
// $rec->hlCtrID=$user->nCtrID;
$rec->hlCtrID=($user->old_db=='clusers' ? 36 : 44);
$rec->hlLan=0;
$rec->hlStat=1;
$rec->hlDateIssue=date('Y-m-d',time());
$rec->hlManID=36;
$rec->hlTime=date('Y-m-d H:i:s',time());
$rec->hlUser=$nUserID;
$rec->hlDealer=($user->old_db=='clusers' ? 51850 : 51851);
$rec->bUjithato=1;
$rec->old_db=$user->old_db;
$rec->product_id=$product;
$crm->setQuery("SELECT * FROM `hardlock` WHERE hlNum=".$newKey." AND product_id=".$product." ORDER BY hlID DESC LIMIT 1;");
$tmp=$crm->loadObjectList();
$exist=$tmp[0];
if ($exist)
{
$values=array();
$query=$crm->getQuery(true);
foreach ((array)$rec as $k=>$v) $values[]=$crm->quoteName($k)."=".$crm->quote($v);
$query->update("hardlock")->set($values)->where(array('`hlID`='.(int)$exist->hlID));
$crm->setQuery($query);
$result=$crm->execute();
//if ($_SERVER['REMOTE_ADDR']=='46.139.14.111') {print_r($exist); print('<br />haha<br />'.$newKey); die();}
}
else
{
$result=$crm->insertObject("hardlock", $rec);
}
$crm->setQuery("SELECT * FROM `computers` WHERE computer_id='".$npid."';");
$tmp233=$crm->loadObjectList();
$comp2=$tmp233[0];
$rec2=new stdClass();
$rec2->computer_id=$comp2->id;
$rec2->isid=$isid;
$rec2->verid=$verid;
$rec2->hlID=$newKey;
$rec2->nUserID=$nUserID;
$rec2->add_datetime=date('Y-m-d H:i:s',time());
$rec2->expire_datetime=date('Y-m-d',time()+60*86400).' 23:59:59';
$rec2->old_db=$user->old_db;
$result2=$crm->insertObject("nonprofit", $rec2);
$rec=new stdClass();
$rec->nUserID=$nUserID;
$rec->nTopicID=($user->old_db=='clusers' ? 300 : 302); //($this->getPrefix()=='jml' ? 300 : 302);
$rec->dateEvent=date('Y-m-d',time());
$rec->strPlace='web';
$rec->strInfo=JText::sprintf("COM_NONPROFIT_KEY_REQUEST_INFO",$newKey);
$rec->nManagerID=36;
$rec->insertDate=date('Y-m-d H:i:s',time());
$result=$crm->insertObject("u_history", $rec);
}
}
}
return ($newKey);
}
public function getPass($nUserID=0,$npid="",$isid="",$verid=0, $product=1)
{
$res="";
if ($npid>"" && $isid>"" && (int)$verid>0)
{
$res=file_get_contents("https://www.archlinexp.com/maintenance/nonprofit.php?npid=".$npid."&isid=".$isid."&verid=".(int)$verid."&createProgram=true&product=".$product);
}
return ($res);
}
/*******************************************************************************
* Megpróbálja az adott kulcs tartományon belül a lehető legkissebb szabad
* kulcsot megtalálni, és visszaadja az számát
******************************************************************************/
public function tryToAlloc($min=0,$max=0)
{
$ret=0;
if ((int)$min==0 || (int)$max==0) return($ret);
$crm=JDatabaseDriver::getInstance($this->getConfig());
$crm->setQuery("SELECT LEFT(hlNum,6) AS hlNum FROM hardlock WHERE hlStat!=0 AND hlNum>=".(int)$min." AND hlNum<".(int)$max." ORDER BY hlNum;");
$res=$crm->loadObjectList();
if (count($res))
{
$keszlet=range($min, $max);
foreach ($res as $r) { $kulcsok[]=$r->hlNum; }
$diff=array_diff($keszlet,$kulcsok);
reset($diff);
$ret=current($diff);
if ((int)$ret>0)
{
$crm->setQuery("DELETE FROM `t_registeronce` WHERE arch_id=".(int)$ret);
$crm->execute();
}
$this->freeKeys=count($diff)-1;
}
return $ret;
}
public function countFreeKeys($min=0,$max=0)
{
$this->tryToAlloc($min,$max);
return ((int)$this->freeKeys);
}
public function sendWarningMail()
{
$app=JFactory::getApplication();
$config=JFactory::getConfig();
$mailer=JFactory::getMailer();
$mailer->setSender(array('info@cadline.hu'));
$mailer->addRecipient(array('office@cadline.hu', 'marketing@cadline.hu'));
$mailer->setSubject(JText::_(($this->freeKeys==0 ? 'COM_NONPROFIT_MAIL_NO_KEY_SUBJECT' : 'COM_NONPROFIT_MAIL_KEY_LOW_SUBJECT')));
$mailer->setBody(JText::sprintf(($this->freeKeys==0 ? 'COM_NONPROFIT_MAIL_NO_KEY_BODY' : 'COM_NONPROFIT_MAIL_KEY_LOW_BODY'),$this->freeKeys));
$mailer->Send();
}
public function sendPasswordInEmail($to, $user, $password, $product)
{
$app=JFactory::getApplication();
$config=JFactory::getConfig();
$mailer=JFactory::getMailer();
$mailer->isHTML(true);
$mailer->setSender(array('info@cadline.hu'));
$mailer->addRecipient(array($to));
if($product == 2) {
$mailer->setSubject("Non-Profit - ARCHLine.XP Live");
$mailer->setBody(JText::sprintf('COM_NONPROFIT_EMAIL_BODY_LIVE', $user, $password));
} else {
$mailer->setSubject("Non-Profit - ARCHLine.XP");
$mailer->setBody(JText::sprintf('COM_NONPROFIT_EMAIL_BODY', $user, $password));
}
$mailer->Send();
}
public function getExistKeys() { return ($this->existKeys); }
public function getLang()
{
return (JFactory::getLanguage()->getTag()=='hu-HU' ? "hun" : "eng");
}
}
?>

View File

@ -1,167 +1,167 @@
<?php defined('_JEXEC') or die; ?>
<?php
header('Cache-Control: no-store, no-cache, must-revalidate');
if (!class_exists('crm_hardlock')) require_once(JPATH_BASE."/common_cadline_libraries/crm_hardlock.class.php");
if(isset($_GET["webform"])) {
$encodedSession = $_GET["session"];
$param = $_GET["param"];
$session = base64_decode($encodedSession);
$privatekey = crm_hardlock::GetWebformPrivateKey();
$param = crm_hardlock::decode($privatekey,$session,$param);
if(!empty($this->newPass)) {
$result = "<NonProfit><Pass>".$this->newPass."</Pass></NonProfit>";
$encodedResult = crm_hardlock::encode($privatekey,$session,$result);
} elseif(!empty($this->regFinished)) {
$result = "<NonProfit><Pass>".$this->regFinished."</Pass></NonProfit>";
$encodedResult = crm_hardlock::encode($privatekey,$session,$result);
}
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$link = crm_hardlock::encode($privatekey, $session, $actual_link);
$linkParam = "?".$param;
$npid = crm_hardlock::get_valueFromStringUrl($linkParam, "npid");
$isid = crm_hardlock::get_valueFromStringUrl($linkParam, "isid");
$product = crm_hardlock::get_valueFromStringUrl($linkParam, "product");
$verid = crm_hardlock::get_valueFromStringUrl($linkParam, "verid");
} else {
$verid = $_GET["verid"];
$npid = $_GET["npid"];
$isid = $_GET["isid"];
}
if(empty($product))
$product = 1;
$user=JFactory::getUser();
?>
<script type="text/javascript">
<?php if ($this->redirect>'') : ?>
jQuery(document).ready(function() { jQuery(location).attr('href','<?=$this->redirect?>'); });
<?php endif;?>
var clipboard = new Clipboard('.btn', { text: function() {
<?php
if(isset($_GET["webform"])) {
if(empty($this->newPass)) {
?>
return '';
<?php
} else {
?>
return '<'+'?xml version="1.0"?'+'><WebFormResult>?session=<?=$encodedSession?>&result_ok=<?=$encodedResult?></WebFormResult>';
<?php
}
} else {
?>
return 'ARCHline.XP_clpbrd_nnprft:<?=$this->newPass?>';
<?php
}
?>
}});
clipboard.on('success', function(e) { console.log(e); });
clipboard.on('error', function(e) { console.log(e); });
</script>
<?php if(/*!$this->hasCommercial || $this->isNpConToThisComp || !$this->isConnectedNonprofitExpired*/ false):?>
<div class="container" style="margin-top:10px;margin-bottom:10px;">
<div class="row form-group">
<h1 class="antracit"><?=$this->article->title?></h1>
<?php
if($product == 2){
$restartButton = JText::_('COM_NONPROFIT_RESTART_LIVE');
$nonpDesc = JText::_('COM_NONPROFIT_DESC_LIVE');
} else {
$restartButton = JText::_('COM_NONPROFIT_RESTART');
$nonpDesc = JText::_('COM_NONPROFIT_DESC');
}
$user=JFactory::getUser();
if ((int)$user->id==0) : ?>
<?=JModuleHelper::renderModule(JModuleHelper::getModule('mod_login','User login'), array())?>
<?php else : ?>
<?php if(empty($_GET["restart"]) || !$_GET["restart"]) : ?>
<form name="nonprofit" id="nonprofit" action="<?=$_SERVER['SCRIPT_URL']?>" method="post">
<?php if ($this->newPass != '') : ?>
<p><strong><?=JText::_('COM_NONPROFIT_SUCCESS')?></strong></p>
<p><?=JText::_('COM_NONPROFIT_PASS')?>:&nbsp;<input type="text" name="newPass" id="newPass" value="<?=$this->newPass?>" readonly /></p>
<?php else :?>
<p><?=JText::_(COM_NONPROFIT_PRESS_BUTTON);?>:</p>
<input type="<?=($this->haveRightsToUseNonprofit==FALSE ? "button" : "submit")?>" name="getid" id="getid" value="<?=JText::_(COM_NONPROFIT_BUTTON);?>" class="btn btn-lg btn-primary <?=($this->haveRightsToUseNonprofit==FALSE ? "disabled" : "")?>" /><br />
<?php endif;?>
<?php if (in_array($_SERVER['REMOTE_ADDR'], array('188.6.239.155','46.139.109.235','46.139.14.111', '79.122.126.144'))) : ?>
<?php endif;?>
</form>
<?php if ($this->newPass != '') : ?>
<form method="GET" action="https://www.archlinexp.com/maintenance/webform/nonprofit.php">
<input type="hidden" name="session" value="<?=$encodedSession?>" />
<input type="hidden" name="result_ok" value="<?=$encodedResult?>" />
<input type="hidden" name="param" value="<?=$link?>" />
<p><?=$nonpDesc?>:</p>
<p><input type="submit" class="btn btn-lg btn-success" value="<?=$restartButton?>" /></p>
</form>
<?php endif;?>
<?php else: ?>
<form name="nonprofit" id="nonprofit" action="<?=$_SERVER['SCRIPT_URL']?>" method="post">
<p><strong><?=JText::_('COM_NONPROFIT_SUCCESS')?></strong></p>
<p><?=JText::_('COM_NONPROFIT_PASS')?>:&nbsp;<input type="text" name="regFinished" id="regFinished" value="<?=$this->regFinished?>" readonly /></p>
</form>
<form method="GET" action="https://www.archlinexp.com/maintenance/webform/nonprofit.php">
<input type="hidden" name="session" value="<?=$encodedSession?>" />
<input type="hidden" name="result_ok" value="<?=$encodedResult?>" />
<input type="hidden" name="param" value="<?=$link?>" />
<p><?=$nonpDesc?>:</p>
<p><input type="submit" class="btn btn-lg btn-success" value="<?=$restartButton?>" /></p>
</form>
<?php endif; ?>
<p>&nbsp;</p>
<?=$this->article->introtext?>
<?=$this->article->fulltext?>
<?php endif;?>
</div>
</div>
<?php endif;?>
<?php if($_SERVER['REMOTE_ADDR'] == '79.122.126.144'): ?>
<style>
#text_div {
margin-top: -10px !important;
}
#nonp_title {
margin-left: 25%;
}
</style>
<div class="container">
<h2 class="sppb-addon-title" id="nonp_title"><b>Non-profit licenc információ</b></h2>
<br/>
<div class="row">
<div class="col-md-6">
<img class="sppb-img-responsive" src="/images/2017/05/04/clients_image_photo.jpg" alt="clients_image_photo.jpg" />
</div>
<div class="col-md-6" id="text_div">
<h4><b>Szeretnél Non-Profit licencet?</b></h4>
<p>Non-profit kód igénylését kifejezetten a szakmában dolgozóknak/tanulóknak javasoljuk.
Ehhez létre kell hozni egy felhasználói fiókot, amelyben megadod a neved, elérhetőséged és e-mail címed. Ezt követően le kell töltened az ARCHLine.XP próbaváltozatát.
Az ARCHLine.XP Non-Profit kóddal a program két hónapig használható.</p>
<br/>
<h4><b>Hogyan kaphatok Non-Profit kódot?</b></h4>
<p>Non-profit kód igényléshez kérjük, írj nekünk egy e-mailt az <a href="mailto:info@cadline.hu">info@cadline.hu</a> címre, melyben 1-2 mondatban indokold meg, hogy miért szeretnél kódot kérni.</p>
<br/>
<h4><b>Igényelhetek terméktámogatást ha Non-Profit kóddal használom a programot?</b></h4>
<p>Igen. E-mailben küldd el kérdésed az <a href="mailto:info@cadline.hu">info@cadline.hu-ra</a>! További segédanyagokat, oktatóvideókat honlapunkon találsz, az Oktatás menüpontban.</p>
</div>
</div>
</div>
<?php endif;?>
<?php defined('_JEXEC') or die; ?>
<?php
header('Cache-Control: no-store, no-cache, must-revalidate');
if (!class_exists('crm_hardlock')) require_once(JPATH_BASE."/common_cadline_libraries/crm_hardlock.class.php");
if(isset($_GET["webform"])) {
$encodedSession = $_GET["session"];
$param = $_GET["param"];
$session = base64_decode($encodedSession);
$privatekey = crm_hardlock::GetWebformPrivateKey();
$param = crm_hardlock::decode($privatekey,$session,$param);
if(!empty($this->newPass)) {
$result = "<NonProfit><Pass>".$this->newPass."</Pass></NonProfit>";
$encodedResult = crm_hardlock::encode($privatekey,$session,$result);
} elseif(!empty($this->regFinished)) {
$result = "<NonProfit><Pass>".$this->regFinished."</Pass></NonProfit>";
$encodedResult = crm_hardlock::encode($privatekey,$session,$result);
}
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$link = crm_hardlock::encode($privatekey, $session, $actual_link);
$linkParam = "?".$param;
$npid = crm_hardlock::get_valueFromStringUrl($linkParam, "npid");
$isid = crm_hardlock::get_valueFromStringUrl($linkParam, "isid");
$product = crm_hardlock::get_valueFromStringUrl($linkParam, "product");
$verid = crm_hardlock::get_valueFromStringUrl($linkParam, "verid");
} else {
$verid = $_GET["verid"];
$npid = $_GET["npid"];
$isid = $_GET["isid"];
}
if(empty($product))
$product = 1;
$user=JFactory::getUser();
?>
<script type="text/javascript">
<?php if ($this->redirect>'') : ?>
jQuery(document).ready(function() { jQuery(location).attr('href','<?=$this->redirect?>'); });
<?php endif;?>
var clipboard = new Clipboard('.btn', { text: function() {
<?php
if(isset($_GET["webform"])) {
if(empty($this->newPass)) {
?>
return '';
<?php
} else {
?>
return '<'+'?xml version="1.0"?'+'><WebFormResult>?session=<?=$encodedSession?>&result_ok=<?=$encodedResult?></WebFormResult>';
<?php
}
} else {
?>
return 'ARCHline.XP_clpbrd_nnprft:<?=$this->newPass?>';
<?php
}
?>
}});
clipboard.on('success', function(e) { console.log(e); });
clipboard.on('error', function(e) { console.log(e); });
</script>
<?php if(/*!$this->hasCommercial || $this->isNpConToThisComp || !$this->isConnectedNonprofitExpired*/ false):?>
<div class="container" style="margin-top:10px;margin-bottom:10px;">
<div class="row form-group">
<h1 class="antracit"><?=$this->article->title?></h1>
<?php
if($product == 2){
$restartButton = JText::_('COM_NONPROFIT_RESTART_LIVE');
$nonpDesc = JText::_('COM_NONPROFIT_DESC_LIVE');
} else {
$restartButton = JText::_('COM_NONPROFIT_RESTART');
$nonpDesc = JText::_('COM_NONPROFIT_DESC');
}
$user=JFactory::getUser();
if ((int)$user->id==0) : ?>
<?=JModuleHelper::renderModule(JModuleHelper::getModule('mod_login','User login'), array())?>
<?php else : ?>
<?php if(empty($_GET["restart"]) || !$_GET["restart"]) : ?>
<form name="nonprofit" id="nonprofit" action="<?=$_SERVER['SCRIPT_URL']?>" method="post">
<?php if ($this->newPass != '') : ?>
<p><strong><?=JText::_('COM_NONPROFIT_SUCCESS')?></strong></p>
<p><?=JText::_('COM_NONPROFIT_PASS')?>:&nbsp;<input type="text" name="newPass" id="newPass" value="<?=$this->newPass?>" readonly /></p>
<?php else :?>
<p><?=JText::_(COM_NONPROFIT_PRESS_BUTTON);?>:</p>
<input type="<?=($this->haveRightsToUseNonprofit==FALSE ? "button" : "submit")?>" name="getid" id="getid" value="<?=JText::_(COM_NONPROFIT_BUTTON);?>" class="btn btn-lg btn-primary <?=($this->haveRightsToUseNonprofit==FALSE ? "disabled" : "")?>" /><br />
<?php endif;?>
<?php if (in_array($_SERVER['REMOTE_ADDR'], array('188.6.239.155','46.139.109.235','46.139.14.111', '79.122.126.144'))) : ?>
<?php endif;?>
</form>
<?php if ($this->newPass != '') : ?>
<form method="GET" action="https://www.archlinexp.com/maintenance/webform/nonprofit.php">
<input type="hidden" name="session" value="<?=$encodedSession?>" />
<input type="hidden" name="result_ok" value="<?=$encodedResult?>" />
<input type="hidden" name="param" value="<?=$link?>" />
<p><?=$nonpDesc?>:</p>
<p><input type="submit" class="btn btn-lg btn-success" value="<?=$restartButton?>" /></p>
</form>
<?php endif;?>
<?php else: ?>
<form name="nonprofit" id="nonprofit" action="<?=$_SERVER['SCRIPT_URL']?>" method="post">
<p><strong><?=JText::_('COM_NONPROFIT_SUCCESS')?></strong></p>
<p><?=JText::_('COM_NONPROFIT_PASS')?>:&nbsp;<input type="text" name="regFinished" id="regFinished" value="<?=$this->regFinished?>" readonly /></p>
</form>
<form method="GET" action="https://www.archlinexp.com/maintenance/webform/nonprofit.php">
<input type="hidden" name="session" value="<?=$encodedSession?>" />
<input type="hidden" name="result_ok" value="<?=$encodedResult?>" />
<input type="hidden" name="param" value="<?=$link?>" />
<p><?=$nonpDesc?>:</p>
<p><input type="submit" class="btn btn-lg btn-success" value="<?=$restartButton?>" /></p>
</form>
<?php endif; ?>
<p>&nbsp;</p>
<?=$this->article->introtext?>
<?=$this->article->fulltext?>
<?php endif;?>
</div>
</div>
<?php endif;?>
<?php if($_SERVER['REMOTE_ADDR'] == '79.122.126.144'): ?>
<style>
#text_div {
margin-top: -10px !important;
}
#nonp_title {
margin-left: 25%;
}
</style>
<div class="container">
<h2 class="sppb-addon-title" id="nonp_title"><b>Non-profit licenc információ</b></h2>
<br/>
<div class="row">
<div class="col-md-6">
<img class="sppb-img-responsive" src="/images/2017/05/04/clients_image_photo.jpg" alt="clients_image_photo.jpg" />
</div>
<div class="col-md-6" id="text_div">
<h4><b>Szeretnél Non-Profit licencet?</b></h4>
<p>Non-profit kód igénylését kifejezetten a szakmában dolgozóknak/tanulóknak javasoljuk.
Ehhez létre kell hozni egy felhasználói fiókot, amelyben megadod a neved, elérhetőséged és e-mail címed. Ezt követően le kell töltened az ARCHLine.XP próbaváltozatát.
Az ARCHLine.XP Non-Profit kóddal a program két hónapig használható.</p>
<br/>
<h4><b>Hogyan kaphatok Non-Profit kódot?</b></h4>
<p>Non-profit kód igényléshez kérjük, írj nekünk egy e-mailt az <a href="mailto:info@cadline.hu">info@cadline.hu</a> címre, melyben 1-2 mondatban indokold meg, hogy miért szeretnél kódot kérni.</p>
<br/>
<h4><b>Igényelhetek terméktámogatást ha Non-Profit kóddal használom a programot?</b></h4>
<p>Igen. E-mailben küldd el kérdésed az <a href="mailto:info@cadline.hu">info@cadline.hu-ra</a>! További segédanyagokat, oktatóvideókat honlapunkon találsz, az Oktatás menüpontban.</p>
</div>
</div>
</div>
<?php endif;?>

View File

@ -1,148 +1,148 @@
<?php
//https://www.archline.hu/index.php?option=com_nonprofit&view=nonprofit&npid=ff299d03-0d3e-4963-9335-ebfe3972eeb7&isid=aa11&verid=35
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.log.log');
class NonprofitViewNonprofit extends JViewLegacy {
public function display($tpl = null) {
$app=JFactory::getApplication();
$user=JFactory::getUser();
$model=$this->getModel();
if(isset($_GET["webform"])) {
// ----------------------------------------------------------------------- Webform inicializálása -----------------------------------------------------------------------
if (!class_exists('crm_hardlock')) require_once(JPATH_BASE."/common_cadline_libraries/crm_hardlock.class.php");
$encodedSession = $_GET["session"]; // Minden csatorna megnyíláskor egyedi kódot kap, ez a publikus kulcs is
$session = base64_decode($encodedSession);
$param = $_GET["param"]; // Encode-olt adat
$privatekey = crm_hardlock::GetWebformPrivateKey(); // A privát kulcs lekérdezése
$param = crm_hardlock::decode($privatekey,$session,$param); // Adat decode-olása
//crmHelper::SetWebformResource($session, "Ez lesz az üzenet a felhasználónak", "Kattints ide");
// ----------------------------------------------------------------------- Webform inicializálása -----------------------------------------------------------------------
$param = "?".$param;
$npid = crm_hardlock::get_valueFromStringUrl($param, "npid");
$isid = crm_hardlock::get_valueFromStringUrl($param, "isid");
$verid = crm_hardlock::get_valueFromStringUrl($param, "verid");
$product = crm_hardlock::get_valueFromStringUrl($param, "product");
$this->GET_VERSION= $verid;
} else { // Régi nonprofit ág
$npid=trim(addslashes($_GET['npid']));
$isid=trim(addslashes($_GET['isid']));
$this->GET_VERSION=(isset($_GET['verid']) && (int)$_GET['verid']>0 ? (int)$_GET['verid'] : 0);
$product = 1;
}
$verid = ($this->GET_VERSION==0 ? $this->CURRENT_VERSION : $this->GET_VERSION);
$this->CURRENT_VERSION=$model->getCurrentVersion('verPassword8and9');
JFactory::getDocument()->addScript('/components/'.JFactory::getApplication()->input->get('option').'/assets/js/clipboard.min.js');
JLog::addLogger(array('text_file'=>'com_nonprofit.call.php','text_entry_format'=>'{DATE} {TIME} {CLIENTIP} {MESSAGE}'),JLog::ALL,array('com_nonprofit'));
JLog::add("domain: ".JURI::base()." | npid: ".$npid." | isid: ".$isid, JLog::WARNING, 'com_nonprofit');
if (!$user->nUserID) {
$model->syncUser();
$user=JFactory::getUser();
}
$crmUser=$model->getCRMUser($user->nUserID);
// Redirect if curr lang != crm old_db
if ($crmUser->old_db>'') {
$domain="";
$base=JURI::base();
$currLang=$model->getLang();
if ($currLang=='hun' && $crmUser->old_db!='clusers') $domain='http://www.archlinexp.com';
if ($currLang=='eng' && $crmUser->old_db=='clusers') $domain='http://www.archline.hu';
//if ($domain>'') { $this->redirect=$domain."/index.php?option=com_nonprofit&view=nonprofit&npid=".$npid.($isid>''?"&isid=".$isid:'').($this->GET_VERSION>0?"&verid=".$this->GET_VERSION:''); }
}
$this->article=$model->getArticle($product);
$model->hasRecord($user->nUserID, $product, $npid);
$this->hasNonprofitProgram=$model->hasNonprofitProgram;
$this->hasCommercial=$model->hasCommercial;
$this->isNpConToThisComp=$model->isNonprofitConnectedToThisComputer;
$this->isConnectedNonprofitExpired=$model->isConnectedNonprofitExpired;
$this->haveRightsToUseNonprofit = $model->haveRightsToUseNonprofit;
$this->hasToGenerateNonprofit = $model->hasToGenerateNonprofit;
$this->sqlQuery=$model->sqlQuery;
$this->freeKeys=$model->countFreeKeys($model->npRangeMin,$model->npRangeMax);
if (!$this->haveRightsToUseNonprofit || $this->freeKeys == 0) { // Ki kell írnia, hogy nincs joga használni a Nonprofitot
if($this->freeKeys == 0) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_NO_FREE_KEY).''.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
} elseif($this->hasCommercial) {
// Mivel kereskedelmi licencel rendelkezik, ezért nem használhatja a nonprofit programot
if($product == 2) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_EXIST_ISID_LIVE).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
} else {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_EXIST_ISID).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
}
} elseif(!$this->isNpConToThisComp) {
// Másik gépen van regisztrálva
if($product == 2) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_ANOTHER_MACHINE_REGISTERED).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
} else {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_ANOTHER_MACHINE_REGISTERED).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
}
} elseif($this->isConnectedNonprofitExpired) {
// Lejárt a nonprofit
if($product == 2) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_EXPIRED).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
} else {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_EXPIRED).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
}
}
}
if($this->haveRightsToUseNonprofit) {
$model->getExistingKeyAndPass($user->nUserID,$npid,$verid, $product);
$this->regFinished=$model->newPass;
}
if (isset($_POST['getid']) && $this->haveRightsToUseNonprofit && (int)$user->nUserID>0 && (int)$this->freeKeys>0 && isset($npid) && $npid>'') {
if($this->hasToGenerateNonprofit) {
$this->newKey=$model->getKey($user->nUserID,$npid,$isid,$verid, $product);
$this->newPass=$model->getPass($user->nUserID,$npid,$isid,$verid, $product);
} else {
$model->getExistingKeyAndPass($user->nUserID,$npid,$verid, $product);
$this->newKey=$model->newKey;
$this->newPass=$model->newPass;
}
if ($this->newKey>0) {
if($product == 2) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_RESTART_LIVE), 'message');
} else {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_RESTART_SOFTWARE), 'message');
}
if(isset($_GET["webform"])) {
$privatekey = crm_hardlock::GetWebformPrivateKey();
$result = "<NonProfit><Pass>".$this->newPass."</Pass></NonProfit>";
$encodedResult = crm_hardlock::encode($privatekey,$session,$result);
crm_hardlock::SetWebformResult($session, "result_ok", $encodedResult, "", "");
$model->sendPasswordInEmail($user->email, $user->name, $this->newPass, $product);
}
}
if ($this->freeKeys <= 25) $model->sendWarningMail(); // Email küldése Nonprofit aktiválásakor
}
$app->getPathway()->addItem(JText::_(COM_NONPROFIT_NONPROFIT), '');
parent::display($tpl);
}
}
?>
<?php
//https://www.archline.hu/index.php?option=com_nonprofit&view=nonprofit&npid=ff299d03-0d3e-4963-9335-ebfe3972eeb7&isid=aa11&verid=35
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.log.log');
class NonprofitViewNonprofit extends JViewLegacy {
public function display($tpl = null) {
$app=JFactory::getApplication();
$user=JFactory::getUser();
$model=$this->getModel();
if(isset($_GET["webform"])) {
// ----------------------------------------------------------------------- Webform inicializálása -----------------------------------------------------------------------
if (!class_exists('crm_hardlock')) require_once(JPATH_BASE."/common_cadline_libraries/crm_hardlock.class.php");
$encodedSession = $_GET["session"]; // Minden csatorna megnyíláskor egyedi kódot kap, ez a publikus kulcs is
$session = base64_decode($encodedSession);
$param = $_GET["param"]; // Encode-olt adat
$privatekey = crm_hardlock::GetWebformPrivateKey(); // A privát kulcs lekérdezése
$param = crm_hardlock::decode($privatekey,$session,$param); // Adat decode-olása
//crmHelper::SetWebformResource($session, "Ez lesz az üzenet a felhasználónak", "Kattints ide");
// ----------------------------------------------------------------------- Webform inicializálása -----------------------------------------------------------------------
$param = "?".$param;
$npid = crm_hardlock::get_valueFromStringUrl($param, "npid");
$isid = crm_hardlock::get_valueFromStringUrl($param, "isid");
$verid = crm_hardlock::get_valueFromStringUrl($param, "verid");
$product = crm_hardlock::get_valueFromStringUrl($param, "product");
$this->GET_VERSION= $verid;
} else { // Régi nonprofit ág
$npid=trim(addslashes($_GET['npid']));
$isid=trim(addslashes($_GET['isid']));
$this->GET_VERSION=(isset($_GET['verid']) && (int)$_GET['verid']>0 ? (int)$_GET['verid'] : 0);
$product = 1;
}
$verid = ($this->GET_VERSION==0 ? $this->CURRENT_VERSION : $this->GET_VERSION);
$this->CURRENT_VERSION=$model->getCurrentVersion('verPassword8and9');
JFactory::getDocument()->addScript('/components/'.JFactory::getApplication()->input->get('option').'/assets/js/clipboard.min.js');
JLog::addLogger(array('text_file'=>'com_nonprofit.call.php','text_entry_format'=>'{DATE} {TIME} {CLIENTIP} {MESSAGE}'),JLog::ALL,array('com_nonprofit'));
JLog::add("domain: ".JURI::base()." | npid: ".$npid." | isid: ".$isid, JLog::WARNING, 'com_nonprofit');
if (!$user->nUserID) {
$model->syncUser();
$user=JFactory::getUser();
}
$crmUser=$model->getCRMUser($user->nUserID);
// Redirect if curr lang != crm old_db
if ($crmUser->old_db>'') {
$domain="";
$base=JURI::base();
$currLang=$model->getLang();
if ($currLang=='hun' && $crmUser->old_db!='clusers') $domain='http://www.archlinexp.com';
if ($currLang=='eng' && $crmUser->old_db=='clusers') $domain='http://www.archline.hu';
//if ($domain>'') { $this->redirect=$domain."/index.php?option=com_nonprofit&view=nonprofit&npid=".$npid.($isid>''?"&isid=".$isid:'').($this->GET_VERSION>0?"&verid=".$this->GET_VERSION:''); }
}
$this->article=$model->getArticle($product);
$model->hasRecord($user->nUserID, $product, $npid);
$this->hasNonprofitProgram=$model->hasNonprofitProgram;
$this->hasCommercial=$model->hasCommercial;
$this->isNpConToThisComp=$model->isNonprofitConnectedToThisComputer;
$this->isConnectedNonprofitExpired=$model->isConnectedNonprofitExpired;
$this->haveRightsToUseNonprofit = $model->haveRightsToUseNonprofit;
$this->hasToGenerateNonprofit = $model->hasToGenerateNonprofit;
$this->sqlQuery=$model->sqlQuery;
$this->freeKeys=$model->countFreeKeys($model->npRangeMin,$model->npRangeMax);
if (!$this->haveRightsToUseNonprofit || $this->freeKeys == 0) { // Ki kell írnia, hogy nincs joga használni a Nonprofitot
if($this->freeKeys == 0) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_NO_FREE_KEY).''.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
} elseif($this->hasCommercial) {
// Mivel kereskedelmi licencel rendelkezik, ezért nem használhatja a nonprofit programot
if($product == 2) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_EXIST_ISID_LIVE).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
} else {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_EXIST_ISID).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
}
} elseif(!$this->isNpConToThisComp) {
// Másik gépen van regisztrálva
if($product == 2) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_ANOTHER_MACHINE_REGISTERED).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
} else {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_ANOTHER_MACHINE_REGISTERED).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
}
} elseif($this->isConnectedNonprofitExpired) {
// Lejárt a nonprofit
if($product == 2) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_EXPIRED).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
} else {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_EXPIRED).'<br/><br/>'.JText::_(COM_NONPROFIT_SUFFIX), 'notice');
}
}
}
if($this->haveRightsToUseNonprofit) {
$model->getExistingKeyAndPass($user->nUserID,$npid,$verid, $product);
$this->regFinished=$model->newPass;
}
if (isset($_POST['getid']) && $this->haveRightsToUseNonprofit && (int)$user->nUserID>0 && (int)$this->freeKeys>0 && isset($npid) && $npid>'') {
if($this->hasToGenerateNonprofit) {
$this->newKey=$model->getKey($user->nUserID,$npid,$isid,$verid, $product);
$this->newPass=$model->getPass($user->nUserID,$npid,$isid,$verid, $product);
} else {
$model->getExistingKeyAndPass($user->nUserID,$npid,$verid, $product);
$this->newKey=$model->newKey;
$this->newPass=$model->newPass;
}
if ($this->newKey>0) {
if($product == 2) {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_RESTART_LIVE), 'message');
} else {
JFactory::getApplication()->enqueueMessage(JText::_(COM_NONPROFIT_RESTART_SOFTWARE), 'message');
}
if(isset($_GET["webform"])) {
$privatekey = crm_hardlock::GetWebformPrivateKey();
$result = "<NonProfit><Pass>".$this->newPass."</Pass></NonProfit>";
$encodedResult = crm_hardlock::encode($privatekey,$session,$result);
crm_hardlock::SetWebformResult($session, "result_ok", $encodedResult, "", "");
$model->sendPasswordInEmail($user->email, $user->name, $this->newPass, $product);
}
}
if ($this->freeKeys <= 25) $model->sendWarningMail(); // Email küldése Nonprofit aktiválásakor
}
$app->getPathway()->addItem(JText::_(COM_NONPROFIT_NONPROFIT), '');
parent::display($tpl);
}
}
?>

View File

@ -1,31 +1,31 @@
<?php
require_once('BaseController.class.php');
class Controller extends BaseController {
public $pf='DownloadController';
public function procEvent()
{
$product=(int)$_GET['o_id'];
if ($product>0)
{
MySqlHelper::getInstance()->query("SELECT * FROM collection2 WHERE o_id=".$product);
$res=MySqlHelper::getInstance()->fetchAssoc();
if (!empty($res))
{
$tomb = isset($_SESSION['sr_down']) ? $_SESSION['sr_down'] : '';
if (!is_array($tomb) || empty($tomb) || !in_array($product,$tomb))
{
$tomb=$product;
$_SESSION['sr_down']=$tomb;
MySqlHelper::getInstance()->query("UPDATE collection2 SET `down`=`down`+1 WHERE o_id=".$product);
}
}
}
}
}
$controller=new Controller();
$controller->run();
<?php
require_once('BaseController.class.php');
class Controller extends BaseController {
public $pf='DownloadController';
public function procEvent()
{
$product=(int)$_GET['o_id'];
if ($product>0)
{
MySqlHelper::getInstance()->query("SELECT * FROM collection2 WHERE o_id=".$product);
$res=MySqlHelper::getInstance()->fetchAssoc();
if (!empty($res))
{
$tomb = isset($_SESSION['sr_down']) ? $_SESSION['sr_down'] : '';
if (!is_array($tomb) || empty($tomb) || !in_array($product,$tomb))
{
$tomb=$product;
$_SESSION['sr_down']=$tomb;
MySqlHelper::getInstance()->query("UPDATE collection2 SET `down`=`down`+1 WHERE o_id=".$product);
}
}
}
}
}
$controller=new Controller();
$controller->run();

View File

@ -1,386 +1,386 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class ShowroomModelFamily extends JModelItem
{
protected $article;
protected $families;
protected $family;
protected $products;
protected $product;
protected $files;
protected $arrKnownFiles=array('oli','matdata','environment','pdf','ifc');
protected $sess;
protected $limit=50;
protected $productThumb='public/img/collection';
protected $productDir='public/collection';
protected $querystring;
protected $struct;
public function getFamilies($family="",$m_id=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->families))
{
$db=JFactory::getDBO();
if ($m_id==0)
{
$db->setQuery("
SELECT c.c_id,c.nev_hun,c.nev_eng,c.m_id,m.`name` AS manufacture, m.dir,c.deleted AS c_deleted,m.deleted AS m_deleted
FROM coll2_cat c
LEFT OUTER JOIN coll2_man m ON m.id=c.m_id
WHERE c.c_id=".(int)$family." LIMIT 1;");
$tmp=$db->loadObjectList();
$manufacture=(int)$tmp[0]->m_id;
}
else
{
$manufacture=$m_id;
}
$db->setQuery("
SELECT f.c_id,f.m_id,m.`name` AS manufacture,IF( LENGTH(f.nev_".$lang.")>20,CONCAT(SUBSTRING(f.nev_".$lang.",1,18),'...'),f.nev_".$lang.") AS family_short,f.nev_".$lang." AS family,cnt.darab
FROM coll2_cat f
LEFT OUTER JOIN (
SELECT COUNT(*) AS darab,c_id,c_name FROM (
SELECT x.o_id,x.tipus,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".($manufacture>0 ? "AND x.m_id='".$manufacture."'" : "")."
) x GROUP BY c_id
) cnt ON cnt.c_id=f.c_id
LEFT OUTER JOIN coll2_man m ON m.id=f.m_id
WHERE f.deleted=0 AND m.deleted=0 AND cnt.darab>0
ORDER BY f.nev_".$lang.";");
$this->families = $db->loadObjectList();
}
return $this->families;
}
public function getFamily($id=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
if ($id>0 && (!isset($this->family) or empty($this->family)))
{
$db=JFactory::getDBO();
$db->setQuery("SELECT c_id,m_id,nev_".$lang." AS name,deleted FROM coll2_cat WHERE c_id=".$id." LIMIT 1;");
$tmp=$db->loadObjectList();
$this->family=$tmp[0];
}
return $this->family;
}
public function getProducts($family="",$m_id=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->products))
{
$db = JFactory::getDBO();
$db->setQuery("
SELECT x.o_id AS id,x.title_".$lang." AS `title`,IF( LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,x.desc_".$lang." AS `desc`,CONCAT('/','".$this->productThumb."','/',m.dir,'/',x.o_id,'/zz_thumb.jpg') AS img,v.`file`,v.`version`,x.rendelheto,x.`show`,x.`down`,x.tipus,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (
SELECT ver_id,o_id,fajl AS `file`,version FROM (
SELECT * FROM coll2_ver WHERE version<=".$this->getPrVersion()." ORDER BY o_id ASC,version DESC
) z GROUP BY o_id
) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".($m_id>0 ? " AND x.m_id='".$m_id."'":"")." ".((int)$family>0 ? ' AND x.c_id='.(int)$family.' ORDER BY x.title_'.$lang : ' ORDER BY RAND() LIMIT 0,'.$this->limit).";");
$this->products = $db->loadObjectList();
}
return $this->products;
}
public function getProduct($product=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->product) && (int)$product>0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT
x.o_id AS id,x.title_".$lang." AS `title`,IF( LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,
x.desc_".$lang." AS `desc`,CONCAT('/".$this->getProductThumb()."/',m.dir,'/',x.o_id,'/zz_big.jpg') AS img,v.file,v.version,
x.rendelheto,x.`show`,x.`down`,x.tipus,t.name_".$lang." AS tipus_lang,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,
x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,IF( LENGTH(c.nev_".$lang.")>15,CONCAT(SUBSTRING(c.nev_".$lang.",1,13),'...'),c.nev_".$lang.") AS `c_name_short`,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (SELECT ver_id,o_id,fajl AS file,version FROM coll2_ver WHERE o_id=".(int)$product." AND version<=".$this->getPrVersion()." ORDER BY version DESC LIMIT 1) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;");
$tmp = $db->loadObjectList();
$this->product = $tmp[0];
}
return $this->product;
}
public function getPrVersion()
{
$ret=2012;
if (!isset($this->prversion) || (int)$this->prversion==0)
{
$db=JFactory::getDBO();
$session=JFactory::getSession();
$ver=(int)$session->get('sr_ver');
if ($ver)
{
$db->setQuery("SELECT * FROM coll2_prversion WHERE ver=".$ver);
$row=$db->loadObjectList();
if (!empty($row)) $ret=(int)$row[0]->prversion;
}
$this->prversion=$ret;
}
else
{
$ret=$this->prversion;
}
return ($ret);
}
public function getFiles($id=0)
{
if ((int)$id<=0) return(FALSE);
$this->folder=$this->getFullPath($id);
if (is_dir($this->folder)) $this->files=$this->getFilteredFiles(scandir($this->folder),$id);
return $this->files;
}
public function getFilteredFiles($tomb=array(),$id)
{
$ret=array();
$this->filter=array('.','..','.quarantine');
if (is_array($tomb) and count($tomb))
{
foreach ($tomb as $file)
{
if (!in_array($file, $this->filter))
{
$parts=explode(".", $file);
$obj=new stdClass;
$obj->name=$file;
$obj->path=$this->getPath($id).$file;
$obj->fullpath=$_SERVER['DOCUMENT_ROOT'].$obj->path;
$obj->extension=(in_array(strtolower(end($parts)),$this->arrKnownFiles) ? strtolower(end($parts)) : 'unknown');
$obj->filesize=filesize($obj->fullpath);
$obj->datetime=filemtime($obj->fullpath);
$obj->icon='/components/com_showroom/assets/images/'.$obj->extension.'.png';
$obj->multidownloadlink=($obj->extension=='pdf' ? $obj->path : $this->getMultiDownloadLink($id,$obj->path));
$ret[]=$obj;
}
}
}
return $ret;
}
public function getPath($id=0)
{
$path='';
if ((int)$id>0)
{
$itm=$this->getProduct($id);
$path='/'.$this->productDir.'/'.$itm->dir.'/'.(int)$id.'/';
}
return $path;
}
public function getFullPath($id=0)
{
$path='';
if ((int)$id>0) { $path=$_SERVER['DOCUMENT_ROOT'].$this->getPath($id); }
return $path;
}
public function getMultiDownloadLink($id,$path)
{
$ret="";
$obj=$this->getProduct($id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
/*
$fajlok=@scandir($this->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=$obj->file; }
else { $f=$fajlok[2]; }
*/
if ($path>"")
{
$ret=$path."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($this->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
((int)$_SESSION['__default']['sr_ver']>=32 ? '&multi='.($_SESSION['__default']['sr_multi']>'' ? $_SESSION['__default']['sr_multi'] : 'false') : '');
if ((int)$_SESSION['__default']['sr_ver']>=33)
{
$struct=$this->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getArticle($alias='showroom')
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM #__content WHERE alias='".$alias."' LIMIT 1;");
$tmp=$db->loadObjectList();
$this->article=$tmp[0];
return $this->article;
}
public function getStruct($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT s.`id`,s.`struct_eng` AS `subcategory`,s.`parent` AS `parent_id`,p.`struct_eng` AS `category`
FROM coll2_struct s
LEFT OUTER JOIN (SELECT * FROM coll2_struct WHERE parent=id) p ON s.parent=p.id
WHERE s.id=(SELECT struct_id FROM collection2 WHERE o_id=".(int)$id.") LIMIT 1;");
$tmp=$db->loadObjectList();
$this->struct=$tmp[0];
return($this->struct);
}
public function getProductThumb() { return $this->productThumb; }
public function getProductDir() { return $this->productDir; }
public function getLang()
{
return (JFactory::getLanguage()->getTag()=='hu-HU' ? "hun" : "eng");
}
public function getURL($url='')
{
$sefurl=$nonsefurl='';
$db=JFactory::getDBO();
$url=trim($url);
if (substr($url,0,1)=='/') $url=substr($url,1);
$lang=&JFactory::getSession()->get('sr_lang');
$table=($lang=='hun' ? 'jml_' : 'eng_')."sh404sef_urls";
$db->setQuery("SELECT * FROM `".$table."` WHERE `".(substr($url, 0, 5)=='index' ? "newurl" : "oldurl" )."`='".$url."' LIMIT 1;");
$tmp=$db->loadObjectList();
if (!empty($tmp))
{
$sefurl=$tmp[0]->oldurl;
$nonsefurl=$tmp[0]->newurl;
parse_str($nonsefurl, $output);
$id=(int)$output['product'];
}
else
{
$id=(int)$_GET['product'];
$product=$this->getProduct($id);
$sefurl=$this->createSlug($lang=='hun' ? 'bemutatoterem' : 'showroom').'/'.$this->createSlug($product->tipus_lang).'/'.$this->createSlug($product->m_name).'/'.$this->createSlug($product->c_name).'/'.$this->createSlug($product->title);
$nonsefurl='index.php?option=com_showroom&view=product&product='.$id.'&lang='.$lang;
$db->setQuery("SELECT * FROM ".$table." WHERE oldurl='".$sefurl."' LIMIT 1;");
$tmp=$db->loadObjectList();
if (empty($tmp) && $id>0)
{
$tomb=New stdClass();
$tomb->cpt=1;
$tomb->rank=0;
$tomb->oldurl=$sefurl;
$tomb->newurl=$nonsefurl;
$tomb->dateadd=date('Y-m-d',time());
$db->insertObject($table, $tomb);
}
}
return array('sef'=>$sefurl,'nonsef'=>$nonsefurl,'lang'=>$lang,'id'=>$id);
}
public function getURLbyID($id=0)
{
$db=JFactory::getDBO();
$sefurl=$nonsefurl='';
$lang=JFactory::getSession()->get('sr_lang');
$table=($lang=='hun' ? 'jml_' : 'eng_')."sh404sef_urls";
$sql="SELECT * FROM `".$table."` WHERE `newurl`='index.php?option=com_showroom&view=product&product=".$id."&lang=".$lang."' LIMIT 1;";
$db->setQuery($sql);
$tmp=$db->loadObjectList();
if (!empty($tmp))
{
$sefurl=$tmp[0]->oldurl;
$nonsefurl=$tmp[0]->newurl;
parse_str($nonsefurl, $output);
$id=(int)$output['product'];
}
else
{
if ($id>0)
{
$product=$this->getProduct($id);
$sefurl=$this->createSlug($lang=='hun' ? 'bemutatoterem' : 'showroom').'/'.$this->createSlug($product->tipus_lang).'/'.$this->createSlug($product->m_name).'/'.$this->createSlug($product->c_name).'/'.$this->createSlug($product->title);
$nonsefurl='index.php?option=com_showroom&view=product&product='.$id.'&lang='.$lang;
$tomb=New stdClass();
$tomb->cpt=1;
$tomb->rank=0;
$tomb->oldurl=$sefurl;
$tomb->newurl=$nonsefurl;
$tomb->dateadd=date('Y-m-d',time());
$db->insertObject($table, $tomb);
}
}
return array('sef'=>$sefurl,'nonsef'=>$nonsefurl,'lang'=>$lang,'id'=>$id);
}
public function createSlug($string, $delimiter = '-') {
if (!extension_loaded('iconv')) { throw new Exception('iconv module not loaded'); }
$oldLocale = setlocale(LC_ALL, '0'); // Save the old locale and set the new locale to UTF-8
setlocale(LC_ALL, 'en_US.UTF-8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower($clean);
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
$clean = trim($clean, $delimiter);
setlocale(LC_ALL, $oldLocale); // Revert back to the old locale
return $clean;
}
}
?>
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class ShowroomModelFamily extends JModelItem
{
protected $article;
protected $families;
protected $family;
protected $products;
protected $product;
protected $files;
protected $arrKnownFiles=array('oli','matdata','environment','pdf','ifc');
protected $sess;
protected $limit=50;
protected $productThumb='public/img/collection';
protected $productDir='public/collection';
protected $querystring;
protected $struct;
public function getFamilies($family="",$m_id=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->families))
{
$db=JFactory::getDBO();
if ($m_id==0)
{
$db->setQuery("
SELECT c.c_id,c.nev_hun,c.nev_eng,c.m_id,m.`name` AS manufacture, m.dir,c.deleted AS c_deleted,m.deleted AS m_deleted
FROM coll2_cat c
LEFT OUTER JOIN coll2_man m ON m.id=c.m_id
WHERE c.c_id=".(int)$family." LIMIT 1;");
$tmp=$db->loadObjectList();
$manufacture=(int)$tmp[0]->m_id;
}
else
{
$manufacture=$m_id;
}
$db->setQuery("
SELECT f.c_id,f.m_id,m.`name` AS manufacture,IF( LENGTH(f.nev_".$lang.")>20,CONCAT(SUBSTRING(f.nev_".$lang.",1,18),'...'),f.nev_".$lang.") AS family_short,f.nev_".$lang." AS family,cnt.darab
FROM coll2_cat f
LEFT OUTER JOIN (
SELECT COUNT(*) AS darab,c_id,c_name FROM (
SELECT x.o_id,x.tipus,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".($manufacture>0 ? "AND x.m_id='".$manufacture."'" : "")."
) x GROUP BY c_id
) cnt ON cnt.c_id=f.c_id
LEFT OUTER JOIN coll2_man m ON m.id=f.m_id
WHERE f.deleted=0 AND m.deleted=0 AND cnt.darab>0
ORDER BY f.nev_".$lang.";");
$this->families = $db->loadObjectList();
}
return $this->families;
}
public function getFamily($id=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
if ($id>0 && (!isset($this->family) or empty($this->family)))
{
$db=JFactory::getDBO();
$db->setQuery("SELECT c_id,m_id,nev_".$lang." AS name,deleted FROM coll2_cat WHERE c_id=".$id." LIMIT 1;");
$tmp=$db->loadObjectList();
$this->family=$tmp[0];
}
return $this->family;
}
public function getProducts($family="",$m_id=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->products))
{
$db = JFactory::getDBO();
$db->setQuery("
SELECT x.o_id AS id,x.title_".$lang." AS `title`,IF( LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,x.desc_".$lang." AS `desc`,CONCAT('/','".$this->productThumb."','/',m.dir,'/',x.o_id,'/zz_thumb.jpg') AS img,v.`file`,v.`version`,x.rendelheto,x.`show`,x.`down`,x.tipus,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (
SELECT ver_id,o_id,fajl AS `file`,version FROM (
SELECT * FROM coll2_ver WHERE version<=".$this->getPrVersion()." ORDER BY o_id ASC,version DESC
) z GROUP BY o_id
) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".($m_id>0 ? " AND x.m_id='".$m_id."'":"")." ".((int)$family>0 ? ' AND x.c_id='.(int)$family.' ORDER BY x.title_'.$lang : ' ORDER BY RAND() LIMIT 0,'.$this->limit).";");
$this->products = $db->loadObjectList();
}
return $this->products;
}
public function getProduct($product=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->product) && (int)$product>0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT
x.o_id AS id,x.title_".$lang." AS `title`,IF( LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,
x.desc_".$lang." AS `desc`,CONCAT('/".$this->getProductThumb()."/',m.dir,'/',x.o_id,'/zz_big.jpg') AS img,v.file,v.version,
x.rendelheto,x.`show`,x.`down`,x.tipus,t.name_".$lang." AS tipus_lang,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,
x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,IF( LENGTH(c.nev_".$lang.")>15,CONCAT(SUBSTRING(c.nev_".$lang.",1,13),'...'),c.nev_".$lang.") AS `c_name_short`,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (SELECT ver_id,o_id,fajl AS file,version FROM coll2_ver WHERE o_id=".(int)$product." AND version<=".$this->getPrVersion()." ORDER BY version DESC LIMIT 1) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;");
$tmp = $db->loadObjectList();
$this->product = $tmp[0];
}
return $this->product;
}
public function getPrVersion()
{
$ret=2012;
if (!isset($this->prversion) || (int)$this->prversion==0)
{
$db=JFactory::getDBO();
$session=JFactory::getSession();
$ver=(int)$session->get('sr_ver');
if ($ver)
{
$db->setQuery("SELECT * FROM coll2_prversion WHERE ver=".$ver);
$row=$db->loadObjectList();
if (!empty($row)) $ret=(int)$row[0]->prversion;
}
$this->prversion=$ret;
}
else
{
$ret=$this->prversion;
}
return ($ret);
}
public function getFiles($id=0)
{
if ((int)$id<=0) return(FALSE);
$this->folder=$this->getFullPath($id);
if (is_dir($this->folder)) $this->files=$this->getFilteredFiles(scandir($this->folder),$id);
return $this->files;
}
public function getFilteredFiles($tomb=array(),$id)
{
$ret=array();
$this->filter=array('.','..','.quarantine');
if (is_array($tomb) and count($tomb))
{
foreach ($tomb as $file)
{
if (!in_array($file, $this->filter))
{
$parts=explode(".", $file);
$obj=new stdClass;
$obj->name=$file;
$obj->path=$this->getPath($id).$file;
$obj->fullpath=$_SERVER['DOCUMENT_ROOT'].$obj->path;
$obj->extension=(in_array(strtolower(end($parts)),$this->arrKnownFiles) ? strtolower(end($parts)) : 'unknown');
$obj->filesize=filesize($obj->fullpath);
$obj->datetime=filemtime($obj->fullpath);
$obj->icon='/components/com_showroom/assets/images/'.$obj->extension.'.png';
$obj->multidownloadlink=($obj->extension=='pdf' ? $obj->path : $this->getMultiDownloadLink($id,$obj->path));
$ret[]=$obj;
}
}
}
return $ret;
}
public function getPath($id=0)
{
$path='';
if ((int)$id>0)
{
$itm=$this->getProduct($id);
$path='/'.$this->productDir.'/'.$itm->dir.'/'.(int)$id.'/';
}
return $path;
}
public function getFullPath($id=0)
{
$path='';
if ((int)$id>0) { $path=$_SERVER['DOCUMENT_ROOT'].$this->getPath($id); }
return $path;
}
public function getMultiDownloadLink($id,$path)
{
$ret="";
$obj=$this->getProduct($id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
/*
$fajlok=@scandir($this->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=$obj->file; }
else { $f=$fajlok[2]; }
*/
if ($path>"")
{
$ret=$path."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($this->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
((int)$_SESSION['__default']['sr_ver']>=32 ? '&multi='.($_SESSION['__default']['sr_multi']>'' ? $_SESSION['__default']['sr_multi'] : 'false') : '');
if ((int)$_SESSION['__default']['sr_ver']>=33)
{
$struct=$this->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getArticle($alias='showroom')
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM #__content WHERE alias='".$alias."' LIMIT 1;");
$tmp=$db->loadObjectList();
$this->article=$tmp[0];
return $this->article;
}
public function getStruct($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT s.`id`,s.`struct_eng` AS `subcategory`,s.`parent` AS `parent_id`,p.`struct_eng` AS `category`
FROM coll2_struct s
LEFT OUTER JOIN (SELECT * FROM coll2_struct WHERE parent=id) p ON s.parent=p.id
WHERE s.id=(SELECT struct_id FROM collection2 WHERE o_id=".(int)$id.") LIMIT 1;");
$tmp=$db->loadObjectList();
$this->struct=$tmp[0];
return($this->struct);
}
public function getProductThumb() { return $this->productThumb; }
public function getProductDir() { return $this->productDir; }
public function getLang()
{
return (JFactory::getLanguage()->getTag()=='hu-HU' ? "hun" : "eng");
}
public function getURL($url='')
{
$sefurl=$nonsefurl='';
$db=JFactory::getDBO();
$url=trim($url);
if (substr($url,0,1)=='/') $url=substr($url,1);
$lang=&JFactory::getSession()->get('sr_lang');
$table=($lang=='hun' ? 'jml_' : 'eng_')."sh404sef_urls";
$db->setQuery("SELECT * FROM `".$table."` WHERE `".(substr($url, 0, 5)=='index' ? "newurl" : "oldurl" )."`='".$url."' LIMIT 1;");
$tmp=$db->loadObjectList();
if (!empty($tmp))
{
$sefurl=$tmp[0]->oldurl;
$nonsefurl=$tmp[0]->newurl;
parse_str($nonsefurl, $output);
$id=(int)$output['product'];
}
else
{
$id=(int)$_GET['product'];
$product=$this->getProduct($id);
$sefurl=$this->createSlug($lang=='hun' ? 'bemutatoterem' : 'showroom').'/'.$this->createSlug($product->tipus_lang).'/'.$this->createSlug($product->m_name).'/'.$this->createSlug($product->c_name).'/'.$this->createSlug($product->title);
$nonsefurl='index.php?option=com_showroom&view=product&product='.$id.'&lang='.$lang;
$db->setQuery("SELECT * FROM ".$table." WHERE oldurl='".$sefurl."' LIMIT 1;");
$tmp=$db->loadObjectList();
if (empty($tmp) && $id>0)
{
$tomb=New stdClass();
$tomb->cpt=1;
$tomb->rank=0;
$tomb->oldurl=$sefurl;
$tomb->newurl=$nonsefurl;
$tomb->dateadd=date('Y-m-d',time());
$db->insertObject($table, $tomb);
}
}
return array('sef'=>$sefurl,'nonsef'=>$nonsefurl,'lang'=>$lang,'id'=>$id);
}
public function getURLbyID($id=0)
{
$db=JFactory::getDBO();
$sefurl=$nonsefurl='';
$lang=JFactory::getSession()->get('sr_lang');
$table=($lang=='hun' ? 'jml_' : 'eng_')."sh404sef_urls";
$sql="SELECT * FROM `".$table."` WHERE `newurl`='index.php?option=com_showroom&view=product&product=".$id."&lang=".$lang."' LIMIT 1;";
$db->setQuery($sql);
$tmp=$db->loadObjectList();
if (!empty($tmp))
{
$sefurl=$tmp[0]->oldurl;
$nonsefurl=$tmp[0]->newurl;
parse_str($nonsefurl, $output);
$id=(int)$output['product'];
}
else
{
if ($id>0)
{
$product=$this->getProduct($id);
$sefurl=$this->createSlug($lang=='hun' ? 'bemutatoterem' : 'showroom').'/'.$this->createSlug($product->tipus_lang).'/'.$this->createSlug($product->m_name).'/'.$this->createSlug($product->c_name).'/'.$this->createSlug($product->title);
$nonsefurl='index.php?option=com_showroom&view=product&product='.$id.'&lang='.$lang;
$tomb=New stdClass();
$tomb->cpt=1;
$tomb->rank=0;
$tomb->oldurl=$sefurl;
$tomb->newurl=$nonsefurl;
$tomb->dateadd=date('Y-m-d',time());
$db->insertObject($table, $tomb);
}
}
return array('sef'=>$sefurl,'nonsef'=>$nonsefurl,'lang'=>$lang,'id'=>$id);
}
public function createSlug($string, $delimiter = '-') {
if (!extension_loaded('iconv')) { throw new Exception('iconv module not loaded'); }
$oldLocale = setlocale(LC_ALL, '0'); // Save the old locale and set the new locale to UTF-8
setlocale(LC_ALL, 'en_US.UTF-8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower($clean);
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
$clean = trim($clean, $delimiter);
setlocale(LC_ALL, $oldLocale); // Revert back to the old locale
return $clean;
}
}
?>

View File

@ -1,374 +1,374 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class ShowroomModelProduct extends JModelItem
{
protected $article;
protected $families=array();
protected $family;
protected $products=array();
protected $product;
protected $files;
protected $arrKnownFiles=array('oli','matdata','environment','pdf','ifc');
protected $sess;
protected $limit=50;
protected $productThumb='public/img/collection';
protected $productDir='public/collection';
protected $querystring;
protected $prversion;
protected $struct;
public function getFamilies($product=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
if (!isset($this->families) or empty($this->families) )
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT x.*
FROM collection2 x
LEFT OUTER JOIN coll2_cat c ON c.c_id=x.c_id
LEFT OUTER JOIN coll2_man m ON m.id=x.m_id
WHERE x.deleted=0 AND c.deleted=0 AND m.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;");
$tmp=$db->loadObjectList();
$manufacture=(int)$tmp[0]->m_id;
if ($manufacture>0)
{
$db->setQuery("
SELECT f.c_id,f.m_id,m.`name` AS manufacture,IF( LENGTH(f.nev_".$lang.")>25,CONCAT(SUBSTRING(f.nev_".$lang.",1,23),'...'),f.nev_".$lang.") AS family_short,f.nev_".$lang." AS family,cnt.darab
FROM coll2_cat f
LEFT OUTER JOIN (
SELECT COUNT(*) AS darab,c_id,c_name FROM (
SELECT x.o_id,x.tipus,x.deleted,x.m_id,m.`name` AS m_name,m.deleted AS m_deleted,x.c_id,c.nev_hun AS c_name,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".($manufacture>0 ? "AND x.m_id='".$manufacture."'" : "")."
) x GROUP BY c_id
) cnt ON cnt.c_id=f.c_id
LEFT OUTER JOIN coll2_man m ON m.id=f.m_id
WHERE f.deleted=0 AND m.deleted=0 AND cnt.darab>0
ORDER BY f.nev_".$lang.";");
$this->families = $db->loadObjectList();
}
}
return $this->families;
}
public function getFamilyID($product=0)
{
$session=JFactory::getSession();
$lang=$session->get( 'sr_lang');//'hun';
if ($product>0)
{
$db=JFactory::getDBO();
$sql="
SELECT x.c_id
FROM collection2 x
LEFT OUTER JOIN coll2_cat c ON c.c_id=x.c_id
LEFT OUTER JOIN coll2_man m ON m.id=x.m_id
WHERE x.deleted=0 AND c.deleted=0 AND m.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;";
$db->setQuery($sql);
$tmp=$db->loadObjectList();
$this->family = (int)$tmp[0]->c_id;
}
return $this->family;
}
public function getFamily($id=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
if ($id>0)
{
$db=JFactory::getDBO();
$db->setQuery("SELECT c_id,m_id,nev_".$lang." AS name,deleted FROM coll2_cat WHERE c_id=".$id." LIMIT 1;");
$tmp=$db->loadObjectList();
$this->family=$tmp[0];
}
return $this->family;
}
public function getProducts($family="",$lang="hun")
{
$session=JFactory::getSession();
// $lang=$session->get('sr_lang');//'hun';
if (!isset($this->products) or empty($this->products) )
{
$db = JFactory::getDBO();
$db->setQuery("
SELECT x.o_id AS id,x.title_".$lang." AS `title`,IF(LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,x.desc_".$lang." AS `desc`,CONCAT('/','".$this->productThumb."','/',m.dir,'/',x.o_id,'/zz_thumb.jpg') AS img,v.`file`,x.rendelheto,x.`show`,x.`down`,x.tipus,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (
SELECT ver_id,o_id,fajl AS `file`,version FROM (
SELECT * FROM coll2_ver WHERE version<=".$this->getPrVersion()." ORDER BY o_id ASC,version DESC
) z GROUP BY o_id
) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".((int)$family>0 ? ' AND x.c_id='.(int)$family.' ORDER BY x.title_'.$lang : ' ORDER BY RAND() LIMIT 0,'.$this->limit).";");
$this->products = $db->loadObjectList();
}
return $this->products;
}
public function getProduct($product=0,$lang="hun")
{
$session=JFactory::getSession();
$lang2=$session->get('sr_lang');
if($lang2 == 'eng') {
$lang=$lang2;
}
if (!isset($this->product) && (int)$product>0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT
x.o_id AS id,x.title_".$lang." AS `title`,IF( LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,
x.desc_".$lang." AS `desc`,CONCAT('/".$this->getProductThumb()."/',m.dir,'/',x.o_id,'/zz_big.jpg') AS img,v.file,v.version,
x.rendelheto,x.`show`,x.`down`,x.tipus, t.name_".$lang." AS tipus_lang,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,
x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,IF( LENGTH(c.nev_".$lang.")>15,CONCAT(SUBSTRING(c.nev_".$lang.",1,13),'...'),c.nev_".$lang.") AS `c_name_short`,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (SELECT ver_id,o_id,fajl AS file,version FROM coll2_ver WHERE o_id=".(int)$product." AND version<=".$this->getPrVersion()." ORDER BY version DESC LIMIT 1) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;");
$tmp = $db->loadObjectList();
$this->product = $tmp[0];
}
return $this->product;
}
public function getPrVersion()
{
$ret=2012;
if (!isset($this->prversion) || (int)$this->prversion==0)
{
$db=JFactory::getDBO();
$session=JFactory::getSession();
$ver=(int)$session->get('sr_ver');
if ($ver)
{
$db->setQuery("SELECT * FROM coll2_prversion WHERE ver=".$ver);
$row=$db->loadObjectList();
if (!empty($row)) $ret=(int)$row[0]->prversion;
}
$this->prversion=$ret;
}
else
{
$ret=$this->prversion;
}
return ($ret);
}
public function getFiles($id=0)
{
if ((int)$id<=0) return(FALSE);
$this->folder=$this->getFullPath($id);
if (is_dir($this->folder)) $this->files=$this->getFilteredFiles(scandir($this->folder),$id);
return $this->files;
}
public function getFilteredFiles($tomb=array(),$id)
{
$ret=array();
$this->filter=array('.','..','.quarantine');
if (is_array($tomb) and count($tomb))
{
foreach ($tomb as $file)
{
if (!in_array($file, $this->filter))
{
$parts=explode(".", $file);
$obj=new stdClass;
$obj->name=$file;
$obj->path=$this->getPath($id).$file;
$obj->fullpath=$_SERVER['DOCUMENT_ROOT'].$obj->path;
$obj->extension=(in_array(strtolower(end($parts)),$this->arrKnownFiles) ? strtolower(end($parts)) : 'unknown');
$obj->filesize=filesize($obj->fullpath);
$obj->datetime=filemtime($obj->fullpath);
$obj->icon='/components/com_showroom/assets/images/'.$obj->extension.'.png';
$obj->multidownloadlink=($obj->extension=='pdf' ? $obj->path : $this->getMultiDownloadLink($id,$obj->path));
$ret[]=$obj;
}
}
}
return $ret;
}
public function getPath($id=0)
{
$path='';
if ((int)$id>0)
{
$itm=$this->getProduct($id);
$path='/'.$this->productDir.'/'.$itm->dir.'/'.(int)$id.'/';
}
return $path;
}
public function getFullPath($id=0)
{
$path='';
if ((int)$id>0) { $path=$_SERVER['DOCUMENT_ROOT'].$this->getPath($id); }
return $path;
}
public function getMultiDownloadLink($id,$path)
{
$ret="";
$obj=$this->getProduct($id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
/*
$fajlok=@scandir($this->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=$obj->file; }
else { $f=$fajlok[2]; }
*/
if ($path>"")
{
$ret=$path."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($this->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
((int)$_SESSION['__default']['sr_ver']>=32 ? '&multi='.($_SESSION['__default']['sr_multi']>'' ? $_SESSION['__default']['sr_multi'] : 'false') : '');
if ((int)$_SESSION['__default']['sr_ver']>=33)
{
$struct=$this->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getArticle($alias='showroom')
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM #__content WHERE alias='".$alias."' LIMIT 1;");
$tmp=$db->loadObjectList();
$this->article=$tmp[0];
return $this->article;
}
public function getStruct($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT s.`id`,s.`struct_eng` AS `subcategory`,s.`parent` AS `parent_id`,p.`struct_eng` AS `category`
FROM coll2_struct s
LEFT OUTER JOIN (SELECT * FROM coll2_struct WHERE parent=id) p ON s.parent=p.id
WHERE s.id=(SELECT struct_id FROM collection2 WHERE o_id=".(int)$id.") LIMIT 1;");
$tmp=$db->loadObjectList();
$this->struct=$tmp[0];
return($this->struct);
}
public function addShow($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("UPDATE collection2 SET `show`=`show`+1 WHERE o_id=".$id);
$db->query();
}
public function getProductThumb() { return $this->productThumb; }
public function getProductDir() { return $this->productDir; }
public function getLang()
{
return (JFactory::getLanguage()->getTag()=='hu-HU' ? "hun" : "eng");
}
public function getURL($url='')
{
$sefurl=$nonsefurl='';
$db=JFactory::getDBO();
$url=trim($url);
if (substr($url,0,1)=='/') $url=substr($url,1);
$lang=JFactory::getSession()->get('sr_lang');
$table=($lang=='hun' ? 'jml_' : 'eng_')."sh404sef_urls";
$db->setQuery("SELECT * FROM `".$table."` WHERE `".(substr($url, 0, 5)=='index' ? "newurl" : "oldurl" )."`='".$url."' LIMIT 1;");
$tmp=$db->loadObjectList();
if (!empty($tmp))
{
$sefurl=$tmp[0]->oldurl;
$nonsefurl=$tmp[0]->newurl;
parse_str($nonsefurl, $output);
$id=(int)$output['product'];
}
else
{
$id=(int)$_GET['product'];
$product=$this->getProduct($id);
$sefurl=$this->createSlug($lang=='hun' ? 'bemutatoterem' : 'showroom').'/'.$this->createSlug($product->tipus_lang).'/'.$this->createSlug($product->m_name).'/'.$this->createSlug($product->c_name).'/'.$this->createSlug($product->title);
$nonsefurl='index.php?option=com_showroom&view=product&product='.$id.'&lang='.$lang;
$db->setQuery("SELECT * FROM ".$table." WHERE oldurl='".$sefurl."' LIMIT 1;");
$tmp=$db->loadObjectList();
if (empty($tmp) && $id>0)
{
$tomb=New stdClass();
$tomb->cpt=1;
$tomb->rank=0;
$tomb->oldurl=$sefurl;
$tomb->newurl=$nonsefurl;
$tomb->dateadd=date('Y-m-d',time());
$db->insertObject($table, $tomb);
}
}
return array('sef'=>$sefurl,'nonsef'=>$nonsefurl,'lang'=>$lang,'id'=>$id);
}
public function createSlug($string, $delimiter = '-') {
if (!extension_loaded('iconv')) { throw new Exception('iconv module not loaded'); }
$oldLocale = setlocale(LC_ALL, '0'); // Save the old locale and set the new locale to UTF-8
setlocale(LC_ALL, 'en_US.UTF-8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower($clean);
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
$clean = trim($clean, $delimiter);
setlocale(LC_ALL, $oldLocale); // Revert back to the old locale
return $clean;
}
}
?>
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class ShowroomModelProduct extends JModelItem
{
protected $article;
protected $families=array();
protected $family;
protected $products=array();
protected $product;
protected $files;
protected $arrKnownFiles=array('oli','matdata','environment','pdf','ifc');
protected $sess;
protected $limit=50;
protected $productThumb='public/img/collection';
protected $productDir='public/collection';
protected $querystring;
protected $prversion;
protected $struct;
public function getFamilies($product=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
if (!isset($this->families) or empty($this->families) )
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT x.*
FROM collection2 x
LEFT OUTER JOIN coll2_cat c ON c.c_id=x.c_id
LEFT OUTER JOIN coll2_man m ON m.id=x.m_id
WHERE x.deleted=0 AND c.deleted=0 AND m.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;");
$tmp=$db->loadObjectList();
$manufacture=(int)$tmp[0]->m_id;
if ($manufacture>0)
{
$db->setQuery("
SELECT f.c_id,f.m_id,m.`name` AS manufacture,IF( LENGTH(f.nev_".$lang.")>25,CONCAT(SUBSTRING(f.nev_".$lang.",1,23),'...'),f.nev_".$lang.") AS family_short,f.nev_".$lang." AS family,cnt.darab
FROM coll2_cat f
LEFT OUTER JOIN (
SELECT COUNT(*) AS darab,c_id,c_name FROM (
SELECT x.o_id,x.tipus,x.deleted,x.m_id,m.`name` AS m_name,m.deleted AS m_deleted,x.c_id,c.nev_hun AS c_name,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".($manufacture>0 ? "AND x.m_id='".$manufacture."'" : "")."
) x GROUP BY c_id
) cnt ON cnt.c_id=f.c_id
LEFT OUTER JOIN coll2_man m ON m.id=f.m_id
WHERE f.deleted=0 AND m.deleted=0 AND cnt.darab>0
ORDER BY f.nev_".$lang.";");
$this->families = $db->loadObjectList();
}
}
return $this->families;
}
public function getFamilyID($product=0)
{
$session=JFactory::getSession();
$lang=$session->get( 'sr_lang');//'hun';
if ($product>0)
{
$db=JFactory::getDBO();
$sql="
SELECT x.c_id
FROM collection2 x
LEFT OUTER JOIN coll2_cat c ON c.c_id=x.c_id
LEFT OUTER JOIN coll2_man m ON m.id=x.m_id
WHERE x.deleted=0 AND c.deleted=0 AND m.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;";
$db->setQuery($sql);
$tmp=$db->loadObjectList();
$this->family = (int)$tmp[0]->c_id;
}
return $this->family;
}
public function getFamily($id=0)
{
$session=JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
if ($id>0)
{
$db=JFactory::getDBO();
$db->setQuery("SELECT c_id,m_id,nev_".$lang." AS name,deleted FROM coll2_cat WHERE c_id=".$id." LIMIT 1;");
$tmp=$db->loadObjectList();
$this->family=$tmp[0];
}
return $this->family;
}
public function getProducts($family="",$lang="hun")
{
$session=JFactory::getSession();
// $lang=$session->get('sr_lang');//'hun';
if (!isset($this->products) or empty($this->products) )
{
$db = JFactory::getDBO();
$db->setQuery("
SELECT x.o_id AS id,x.title_".$lang." AS `title`,IF(LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,x.desc_".$lang." AS `desc`,CONCAT('/','".$this->productThumb."','/',m.dir,'/',x.o_id,'/zz_thumb.jpg') AS img,v.`file`,x.rendelheto,x.`show`,x.`down`,x.tipus,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (
SELECT ver_id,o_id,fajl AS `file`,version FROM (
SELECT * FROM coll2_ver WHERE version<=".$this->getPrVersion()." ORDER BY o_id ASC,version DESC
) z GROUP BY o_id
) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".((int)$family>0 ? ' AND x.c_id='.(int)$family.' ORDER BY x.title_'.$lang : ' ORDER BY RAND() LIMIT 0,'.$this->limit).";");
$this->products = $db->loadObjectList();
}
return $this->products;
}
public function getProduct($product=0,$lang="hun")
{
$session=JFactory::getSession();
$lang2=$session->get('sr_lang');
if($lang2 == 'eng') {
$lang=$lang2;
}
if (!isset($this->product) && (int)$product>0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT
x.o_id AS id,x.title_".$lang." AS `title`,IF( LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,
x.desc_".$lang." AS `desc`,CONCAT('/".$this->getProductThumb()."/',m.dir,'/',x.o_id,'/zz_big.jpg') AS img,v.file,v.version,
x.rendelheto,x.`show`,x.`down`,x.tipus, t.name_".$lang." AS tipus_lang,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,
x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,IF( LENGTH(c.nev_".$lang.")>15,CONCAT(SUBSTRING(c.nev_".$lang.",1,13),'...'),c.nev_".$lang.") AS `c_name_short`,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (SELECT ver_id,o_id,fajl AS file,version FROM coll2_ver WHERE o_id=".(int)$product." AND version<=".$this->getPrVersion()." ORDER BY version DESC LIMIT 1) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;");
$tmp = $db->loadObjectList();
$this->product = $tmp[0];
}
return $this->product;
}
public function getPrVersion()
{
$ret=2012;
if (!isset($this->prversion) || (int)$this->prversion==0)
{
$db=JFactory::getDBO();
$session=JFactory::getSession();
$ver=(int)$session->get('sr_ver');
if ($ver)
{
$db->setQuery("SELECT * FROM coll2_prversion WHERE ver=".$ver);
$row=$db->loadObjectList();
if (!empty($row)) $ret=(int)$row[0]->prversion;
}
$this->prversion=$ret;
}
else
{
$ret=$this->prversion;
}
return ($ret);
}
public function getFiles($id=0)
{
if ((int)$id<=0) return(FALSE);
$this->folder=$this->getFullPath($id);
if (is_dir($this->folder)) $this->files=$this->getFilteredFiles(scandir($this->folder),$id);
return $this->files;
}
public function getFilteredFiles($tomb=array(),$id)
{
$ret=array();
$this->filter=array('.','..','.quarantine');
if (is_array($tomb) and count($tomb))
{
foreach ($tomb as $file)
{
if (!in_array($file, $this->filter))
{
$parts=explode(".", $file);
$obj=new stdClass;
$obj->name=$file;
$obj->path=$this->getPath($id).$file;
$obj->fullpath=$_SERVER['DOCUMENT_ROOT'].$obj->path;
$obj->extension=(in_array(strtolower(end($parts)),$this->arrKnownFiles) ? strtolower(end($parts)) : 'unknown');
$obj->filesize=filesize($obj->fullpath);
$obj->datetime=filemtime($obj->fullpath);
$obj->icon='/components/com_showroom/assets/images/'.$obj->extension.'.png';
$obj->multidownloadlink=($obj->extension=='pdf' ? $obj->path : $this->getMultiDownloadLink($id,$obj->path));
$ret[]=$obj;
}
}
}
return $ret;
}
public function getPath($id=0)
{
$path='';
if ((int)$id>0)
{
$itm=$this->getProduct($id);
$path='/'.$this->productDir.'/'.$itm->dir.'/'.(int)$id.'/';
}
return $path;
}
public function getFullPath($id=0)
{
$path='';
if ((int)$id>0) { $path=$_SERVER['DOCUMENT_ROOT'].$this->getPath($id); }
return $path;
}
public function getMultiDownloadLink($id,$path)
{
$ret="";
$obj=$this->getProduct($id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
/*
$fajlok=@scandir($this->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=$obj->file; }
else { $f=$fajlok[2]; }
*/
if ($path>"")
{
$ret=$path."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($this->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
((int)$_SESSION['__default']['sr_ver']>=32 ? '&multi='.($_SESSION['__default']['sr_multi']>'' ? $_SESSION['__default']['sr_multi'] : 'false') : '');
if ((int)$_SESSION['__default']['sr_ver']>=33)
{
$struct=$this->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getArticle($alias='showroom')
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM #__content WHERE alias='".$alias."' LIMIT 1;");
$tmp=$db->loadObjectList();
$this->article=$tmp[0];
return $this->article;
}
public function getStruct($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT s.`id`,s.`struct_eng` AS `subcategory`,s.`parent` AS `parent_id`,p.`struct_eng` AS `category`
FROM coll2_struct s
LEFT OUTER JOIN (SELECT * FROM coll2_struct WHERE parent=id) p ON s.parent=p.id
WHERE s.id=(SELECT struct_id FROM collection2 WHERE o_id=".(int)$id.") LIMIT 1;");
$tmp=$db->loadObjectList();
$this->struct=$tmp[0];
return($this->struct);
}
public function addShow($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("UPDATE collection2 SET `show`=`show`+1 WHERE o_id=".$id);
$db->query();
}
public function getProductThumb() { return $this->productThumb; }
public function getProductDir() { return $this->productDir; }
public function getLang()
{
return (JFactory::getLanguage()->getTag()=='hu-HU' ? "hun" : "eng");
}
public function getURL($url='')
{
$sefurl=$nonsefurl='';
$db=JFactory::getDBO();
$url=trim($url);
if (substr($url,0,1)=='/') $url=substr($url,1);
$lang=JFactory::getSession()->get('sr_lang');
$table=($lang=='hun' ? 'jml_' : 'eng_')."sh404sef_urls";
$db->setQuery("SELECT * FROM `".$table."` WHERE `".(substr($url, 0, 5)=='index' ? "newurl" : "oldurl" )."`='".$url."' LIMIT 1;");
$tmp=$db->loadObjectList();
if (!empty($tmp))
{
$sefurl=$tmp[0]->oldurl;
$nonsefurl=$tmp[0]->newurl;
parse_str($nonsefurl, $output);
$id=(int)$output['product'];
}
else
{
$id=(int)$_GET['product'];
$product=$this->getProduct($id);
$sefurl=$this->createSlug($lang=='hun' ? 'bemutatoterem' : 'showroom').'/'.$this->createSlug($product->tipus_lang).'/'.$this->createSlug($product->m_name).'/'.$this->createSlug($product->c_name).'/'.$this->createSlug($product->title);
$nonsefurl='index.php?option=com_showroom&view=product&product='.$id.'&lang='.$lang;
$db->setQuery("SELECT * FROM ".$table." WHERE oldurl='".$sefurl."' LIMIT 1;");
$tmp=$db->loadObjectList();
if (empty($tmp) && $id>0)
{
$tomb=New stdClass();
$tomb->cpt=1;
$tomb->rank=0;
$tomb->oldurl=$sefurl;
$tomb->newurl=$nonsefurl;
$tomb->dateadd=date('Y-m-d',time());
$db->insertObject($table, $tomb);
}
}
return array('sef'=>$sefurl,'nonsef'=>$nonsefurl,'lang'=>$lang,'id'=>$id);
}
public function createSlug($string, $delimiter = '-') {
if (!extension_loaded('iconv')) { throw new Exception('iconv module not loaded'); }
$oldLocale = setlocale(LC_ALL, '0'); // Save the old locale and set the new locale to UTF-8
setlocale(LC_ALL, 'en_US.UTF-8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower($clean);
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
$clean = trim($clean, $delimiter);
setlocale(LC_ALL, $oldLocale); // Revert back to the old locale
return $clean;
}
}
?>

View File

@ -1,395 +1,395 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class ShowroomModelSearch extends JModelItem
{
protected $article;
protected $products;
protected $product;
protected $files;
protected $arrKnownFiles=array('oli','matdata','environment','pdf','ifc');
protected $sess;
protected $ipp=48;
protected $all;
protected $page;
protected $last;
protected $first;
protected $visibleLast;
protected $visibleFirst;
protected $pager=3;
protected $productThumb='public/img/collection';
protected $productDir='public/collection';
protected $placeholder;
protected $querystring;
protected $struct;
public function getResult($search="",$multiselect=array(),$page=1)
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');
$search=trim(addslashes($search));
$ms_type=((isset($multiselect['type']) && count($multiselect['type'])) ? " AND x.tipus IN ('".implode("','",$multiselect['type'])."')" : "");
$ms_brand=((isset($multiselect['brand']) && count($multiselect['brand'])) ? " AND x.m_id IN (".implode(',',$multiselect['brand']).")" : "");
$ms_category=((isset($multiselect['category']) && count($multiselect['category'])) ? " AND s.parent IN (".implode(',',$multiselect['category']).")" : "");
$ms_subcategory=((isset($multiselect['subcategory']) && count($multiselect['subcategory'])) ? " AND s.id IN (".implode(',',$multiselect['subcategory']).")" : "");
$sql="
SELECT COUNT(*) AS darab FROM (
SELECT x.o_id AS id,x.tipus,t.type_download,x.title_".$lang." AS `title`,IF(LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,x.desc_".$lang." AS `desc`,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,c.deleted AS c_deleted,CONCAT('/','".$this->productThumb."','/',m.dir,'/',x.o_id,'/zz_thumb.jpg') AS img,v.`file`
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN coll2_struct s ON x.struct_id=s.id
LEFT OUTER JOIN (SELECT id,struct_hun,struct_eng FROM coll2_struct WHERE id=parent) p ON s.parent=p.id
LEFT OUTER JOIN (
SELECT ver_id,o_id,fajl AS `file`,version FROM (
SELECT * FROM coll2_ver WHERE version<=".$this->getPrVersion()." ORDER BY o_id ASC,version DESC
) z GROUP BY o_id
) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".$ms_type." ".$ms_brand." ".$ms_category." ".$ms_subcategory."
AND (
x.title_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
x.desc_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
m.`name` COLLATE utf8_general_ci LIKE '%".$search."%' OR
c.nev_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
s.struct_".$lang." LIKE '%".$search."%' OR
p.struct_".$lang." LIKE '%".$search."%')
) p;";
//print $sql;
$db=JFactory::getDBO();
$db->setQuery($sql);
$tmp=$db->loadObjectList();
$db->setQuery("
SELECT x.o_id AS id,x.tipus,t.type_download,x.title_".$lang." AS `title`,IF(LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,x.desc_".$lang." AS `desc`,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,c.deleted AS c_deleted,CONCAT('/','".$this->productThumb."','/',m.dir,'/',x.o_id,'/zz_thumb.jpg') AS img,v.`file`
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN coll2_struct s ON x.struct_id=s.id
LEFT OUTER JOIN (SELECT id,struct_hun,struct_eng FROM coll2_struct WHERE id=parent) p ON s.parent=p.id
LEFT OUTER JOIN (
SELECT ver_id,o_id,fajl AS `file`,version FROM (
SELECT * FROM coll2_ver WHERE version<=".$this->getPrVersion()." ORDER BY o_id ASC,version DESC
) z GROUP BY o_id
) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".$ms_type." ".$ms_brand." ".$ms_category." ".$ms_subcategory."
AND (
x.title_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
x.desc_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
m.`name` COLLATE utf8_general_ci LIKE '%".$search."%' OR
c.nev_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
s.struct_".$lang." LIKE '%".$search."%' OR
p.struct_".$lang." LIKE '%".$search."%')
ORDER BY x.title_".$lang."
LIMIT ".($page>0 ? $page-1 : 0)*$this->ipp.", ".$this->ipp.";");
$this->products=$db->loadObjectList();
$this->page=((int)$page==0 ? 1 : $page);
$this->all=$tmp[0]->darab;
$this->last=(floor($this->all/$this->ipp)+($this->all%$this->ipp==0 ? 0 : 1));
$this->first=1;
if ($this->last>$this->pager*2+1)
{
if ($this->page<$this->first+$this->pager) { $this->visibleFirst=$this->first;$this->visibleLast=$this->first+$this->pager*2; }
else if ($this->page>$this->last-$this->pager) { $this->visibleFirst=$this->last-$this->pager*2;$this->visibleLast=$this->last; }
else { $this->visibleFirst=$this->page-$this->pager;$this->visibleLast=$this->page+$this->pager; }
}
else { $this->visibleFirst=$this->first;$this->visibleLast=$this->last; }
return $this->products;
}
public function getTypes()
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("SELECT `type`,`name_".$lang."` AS `name` FROM coll2_types t WHERE t.visible='Y' ORDER BY `name_".$lang."`;");
$this->types=$db->loadObjectList();
return $this->types;
}
public function getBrands($types=array())
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(m.`id`),m.`name`
FROM collection2 c
LEFT OUTER JOIN coll2_man m ON c.`m_id`=m.`id`
LEFT OUTER JOIN coll2_cat k ON c.`c_id`=k.`c_id`
LEFT OUTER JOIN coll2_struct s ON c.`struct_id`=s.`id`
LEFT OUTER JOIN (SELECT id,struct_".$lang." FROM coll2_struct WHERE parent=id) p ON p.`id`=s.`parent`
WHERE m.deleted=0 AND c.deleted=0 AND k.deleted=0 ".
((is_array($types)&&count($types))?" AND c.tipus IN ('".implode("','",$types)."')":"")."
ORDER BY m.`name`;");
$this->brands=$db->loadObjectList();
return $this->brands;
}
public function getCategories($types=array(),$brands=array())
{
$session=&JFactory::getSession();
$lang=$session->get( 'sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(p.`id`) AS `id`,p.`struct_".$lang."` AS `name`
FROM collection2 c
LEFT OUTER JOIN coll2_man m ON c.`m_id`=m.`id`
LEFT OUTER JOIN coll2_cat k ON c.`c_id`=k.`c_id`
LEFT OUTER JOIN coll2_struct s ON c.`struct_id`=s.`id`
LEFT OUTER JOIN (SELECT id,struct_".$lang." FROM coll2_struct WHERE parent=id) p ON p.`id`=s.`parent`
WHERE p.`id` IS NOT NULL AND m.deleted=0 AND c.deleted=0 AND k.deleted=0 ".
((is_array($types)&&count($types))?" AND c.tipus IN ('".implode("','",$types)."')":"").
((is_array($brands)&&count($brands))?" AND c.m_id IN (".implode(",",$brands).")":"").
"
ORDER BY p.`struct_".$lang."`;");
$this->categories=$db->loadObjectList();
return $this->categories;
}
public function getSubcategories($types=array(),$brands=array(),$categories=array())
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(s.`id`) AS `id`,s.`struct_".$lang."` AS `name`
FROM collection2 c
LEFT OUTER JOIN coll2_man m ON c.`m_id`=m.`id`
LEFT OUTER JOIN coll2_cat k ON c.`c_id`=k.`c_id`
LEFT OUTER JOIN coll2_struct s ON c.`struct_id`=s.`id`
LEFT OUTER JOIN (SELECT id,struct_".$lang." FROM coll2_struct WHERE parent=id) p ON p.`id`=s.`parent`
WHERE p.`id` IS NOT NULL AND m.deleted=0 AND c.deleted=0 AND k.deleted=0 ".
((is_array($types)&&count($types))?" AND c.tipus IN ('".implode("','",$types)."')":"").
((is_array($brands)&&count($brands))?" AND c.m_id IN (".implode(",",$brands).")":"").
((is_array($categories)&&count($categories))?" AND s.parent IN (".implode(",",$categories).")":"").
"
ORDER BY s.`struct_".$lang."`;");
$this->subcategories=$db->loadObjectList();
return $this->subcategories;
}
public function getPlaceholder($type="sr_type",$value)
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->placeholder))
{
$db=JFactory::getDBO();
switch ($type)
{
case 'sr_type' :
{
$db->setQuery("SELECT `name_".$lang."` AS `name` FROM coll2_types WHERE `type`='".$value."' LIMIT 1;");
$tmp=$db->loadObjectList();
break;
}
case 'sr_manufacture' :
{
$db->setQuery("SELECT `name` AS `name` FROM coll2_man WHERE `id`='".$value."' LIMIT 1;");
$tmp=$db->loadObjectList();
break;
}
}
$this->placeholder=(isset($tmp[0]->name) ? $tmp[0]->name : "");
}
return $this->placeholder;
}
public function getPrVersion()
{
$ret=2012;
if (!isset($this->prversion) || (int)$this->prversion==0)
{
$db=JFactory::getDBO();
$session=&JFactory::getSession();
$ver=(int)$session->get('sr_ver');
if ($ver)
{
$db->setQuery("SELECT * FROM coll2_prversion WHERE ver=".$ver);
$row=$db->loadObjectList();
if (!empty($row)) $ret=(int)$row[0]->prversion;
}
$this->prversion=$ret;
}
else
{
$ret=$this->prversion;
}
return ($ret);
}
public function getArticle($alias='showroom')
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM #__content WHERE alias='".$alias."' LIMIT 1;");
$tmp=$db->loadObjectList();
$this->article=$tmp[0];
return $this->article;
}
public function getProduct($product=0)
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->product) && (int)$product>0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT
x.o_id AS id,x.title_".$lang." AS `title`,IF( LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,
x.desc_".$lang." AS `desc`,CONCAT('/".$this->getProductThumb()."/',m.dir,'/',x.o_id,'/zz_big.jpg') AS img,v.file,v.version,
x.rendelheto,x.`show`,x.`down`,x.tipus,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,
x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,IF( LENGTH(c.nev_".$lang.")>15,CONCAT(SUBSTRING(c.nev_".$lang.",1,13),'...'),c.nev_".$lang.") AS `c_name_short`,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (SELECT ver_id,o_id,fajl AS file,version FROM coll2_ver WHERE o_id=".(int)$product." AND version<=".$this->getPrVersion()." ORDER BY version DESC LIMIT 1) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;");
$tmp = $db->loadObjectList();
$this->product = $tmp[0];
}
return $this->product;
}
public function getFiles($id=0)
{
if ((int)$id<=0) return(FALSE);
$this->folder=$this->getFullPath($id);
if (is_dir($this->folder)) $this->files=$this->getFilteredFiles(scandir($this->folder),$id);
return $this->files;
}
public function getFilteredFiles($tomb=array(),$id)
{
$ret=array();
$this->filter=array('.','..','.quarantine');
if (is_array($tomb) and count($tomb))
{
foreach ($tomb as $file)
{
if (!in_array($file, $this->filter))
{
$parts=explode(".", $file);
$obj=new stdClass;
$obj->name=$file;
$obj->path=$this->getPath($id).$file;
$obj->fullpath=$_SERVER['DOCUMENT_ROOT'].$obj->path;
$obj->extension=(in_array(strtolower(end($parts)),$this->arrKnownFiles) ? strtolower(end($parts)) : 'unknown');
$obj->filesize=filesize($obj->fullpath);
$obj->datetime=filemtime($obj->fullpath);
$obj->icon='/components/com_showroom/assets/images/'.$obj->extension.'.png';
$obj->multidownloadlink=($obj->extension=='pdf' ? $obj->path : $this->getMultiDownloadLink($id,$obj->path));
$ret[]=$obj;
}
}
}
return $ret;
}
public function getPath($id=0)
{
$path='';
if ((int)$id>0)
{
$itm=$this->getProduct($id);
$path='/'.$this->productDir.'/'.$itm->dir.'/'.(int)$id.'/';
}
return $path;
}
public function getFullPath($id=0)
{
$path='';
if ((int)$id>0) { $path=$_SERVER['DOCUMENT_ROOT'].$this->getPath($id); }
return $path;
}
public function getMultiDownloadLink($id,$path)
{
$ret="";
$obj=$this->getProduct($id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
/*
$fajlok=@scandir($this->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=$obj->file; }
else { $f=$fajlok[2]; }
*/
if ($path>"")
{
$ret=$path."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($this->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
((int)$_SESSION['__default']['sr_ver']>=32 ? '&multi='.($_SESSION['__default']['sr_multi']>'' ? $_SESSION['__default']['sr_multi'] : 'false') : '');
if ((int)$_SESSION['__default']['sr_ver']>=33)
{
$struct=$this->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getStruct($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT s.`id`,s.`struct_eng` AS `subcategory`,s.`parent` AS `parent_id`,p.`struct_eng` AS `category`
FROM coll2_struct s
LEFT OUTER JOIN (SELECT * FROM coll2_struct WHERE parent=id) p ON s.parent=p.id
WHERE s.id=(SELECT struct_id FROM collection2 WHERE o_id=".(int)$id.") LIMIT 1;");
$tmp=$db->loadObjectList();
$this->struct=$tmp[0];
return($this->struct);
}
public function getProductThumb() { return $this->productThumb; }
public function getProductDir() { return $this->productDir; }
public function getAll() { return $this->all; }
public function getIPP() { return $this->ipp; }
public function getPage() { return $this->page; }
public function getLast() { return $this->last; }
public function getFirst() { return $this->first; }
public function getPager() { return $this->pager; }
public function getVisibleLast() { return $this->visibleLast; }
public function getVisibleFirst() { return $this->visibleFirst; }
public function getLang()
{
return (JFactory::getLanguage()->getTag()=='hu-HU' ? "hun" : "eng");
}
}
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class ShowroomModelSearch extends JModelItem
{
protected $article;
protected $products;
protected $product;
protected $files;
protected $arrKnownFiles=array('oli','matdata','environment','pdf','ifc');
protected $sess;
protected $ipp=48;
protected $all;
protected $page;
protected $last;
protected $first;
protected $visibleLast;
protected $visibleFirst;
protected $pager=3;
protected $productThumb='public/img/collection';
protected $productDir='public/collection';
protected $placeholder;
protected $querystring;
protected $struct;
public function getResult($search="",$multiselect=array(),$page=1)
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');
$search=trim(addslashes($search));
$ms_type=((isset($multiselect['type']) && count($multiselect['type'])) ? " AND x.tipus IN ('".implode("','",$multiselect['type'])."')" : "");
$ms_brand=((isset($multiselect['brand']) && count($multiselect['brand'])) ? " AND x.m_id IN (".implode(',',$multiselect['brand']).")" : "");
$ms_category=((isset($multiselect['category']) && count($multiselect['category'])) ? " AND s.parent IN (".implode(',',$multiselect['category']).")" : "");
$ms_subcategory=((isset($multiselect['subcategory']) && count($multiselect['subcategory'])) ? " AND s.id IN (".implode(',',$multiselect['subcategory']).")" : "");
$sql="
SELECT COUNT(*) AS darab FROM (
SELECT x.o_id AS id,x.tipus,t.type_download,x.title_".$lang." AS `title`,IF(LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,x.desc_".$lang." AS `desc`,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,c.deleted AS c_deleted,CONCAT('/','".$this->productThumb."','/',m.dir,'/',x.o_id,'/zz_thumb.jpg') AS img,v.`file`
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN coll2_struct s ON x.struct_id=s.id
LEFT OUTER JOIN (SELECT id,struct_hun,struct_eng FROM coll2_struct WHERE id=parent) p ON s.parent=p.id
LEFT OUTER JOIN (
SELECT ver_id,o_id,fajl AS `file`,version FROM (
SELECT * FROM coll2_ver WHERE version<=".$this->getPrVersion()." ORDER BY o_id ASC,version DESC
) z GROUP BY o_id
) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".$ms_type." ".$ms_brand." ".$ms_category." ".$ms_subcategory."
AND (
x.title_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
x.desc_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
m.`name` COLLATE utf8_general_ci LIKE '%".$search."%' OR
c.nev_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
s.struct_".$lang." LIKE '%".$search."%' OR
p.struct_".$lang." LIKE '%".$search."%')
) p;";
//print $sql;
$db=JFactory::getDBO();
$db->setQuery($sql);
$tmp=$db->loadObjectList();
$db->setQuery("
SELECT x.o_id AS id,x.tipus,t.type_download,x.title_".$lang." AS `title`,IF(LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,x.desc_".$lang." AS `desc`,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,c.deleted AS c_deleted,CONCAT('/','".$this->productThumb."','/',m.dir,'/',x.o_id,'/zz_thumb.jpg') AS img,v.`file`
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN coll2_struct s ON x.struct_id=s.id
LEFT OUTER JOIN (SELECT id,struct_hun,struct_eng FROM coll2_struct WHERE id=parent) p ON s.parent=p.id
LEFT OUTER JOIN (
SELECT ver_id,o_id,fajl AS `file`,version FROM (
SELECT * FROM coll2_ver WHERE version<=".$this->getPrVersion()." ORDER BY o_id ASC,version DESC
) z GROUP BY o_id
) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".$ms_type." ".$ms_brand." ".$ms_category." ".$ms_subcategory."
AND (
x.title_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
x.desc_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
m.`name` COLLATE utf8_general_ci LIKE '%".$search."%' OR
c.nev_".$lang." COLLATE utf8_general_ci LIKE '%".$search."%' OR
s.struct_".$lang." LIKE '%".$search."%' OR
p.struct_".$lang." LIKE '%".$search."%')
ORDER BY x.title_".$lang."
LIMIT ".($page>0 ? $page-1 : 0)*$this->ipp.", ".$this->ipp.";");
$this->products=$db->loadObjectList();
$this->page=((int)$page==0 ? 1 : $page);
$this->all=$tmp[0]->darab;
$this->last=(floor($this->all/$this->ipp)+($this->all%$this->ipp==0 ? 0 : 1));
$this->first=1;
if ($this->last>$this->pager*2+1)
{
if ($this->page<$this->first+$this->pager) { $this->visibleFirst=$this->first;$this->visibleLast=$this->first+$this->pager*2; }
else if ($this->page>$this->last-$this->pager) { $this->visibleFirst=$this->last-$this->pager*2;$this->visibleLast=$this->last; }
else { $this->visibleFirst=$this->page-$this->pager;$this->visibleLast=$this->page+$this->pager; }
}
else { $this->visibleFirst=$this->first;$this->visibleLast=$this->last; }
return $this->products;
}
public function getTypes()
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("SELECT `type`,`name_".$lang."` AS `name` FROM coll2_types t WHERE t.visible='Y' ORDER BY `name_".$lang."`;");
$this->types=$db->loadObjectList();
return $this->types;
}
public function getBrands($types=array())
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(m.`id`),m.`name`
FROM collection2 c
LEFT OUTER JOIN coll2_man m ON c.`m_id`=m.`id`
LEFT OUTER JOIN coll2_cat k ON c.`c_id`=k.`c_id`
LEFT OUTER JOIN coll2_struct s ON c.`struct_id`=s.`id`
LEFT OUTER JOIN (SELECT id,struct_".$lang." FROM coll2_struct WHERE parent=id) p ON p.`id`=s.`parent`
WHERE m.deleted=0 AND c.deleted=0 AND k.deleted=0 ".
((is_array($types)&&count($types))?" AND c.tipus IN ('".implode("','",$types)."')":"")."
ORDER BY m.`name`;");
$this->brands=$db->loadObjectList();
return $this->brands;
}
public function getCategories($types=array(),$brands=array())
{
$session=&JFactory::getSession();
$lang=$session->get( 'sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(p.`id`) AS `id`,p.`struct_".$lang."` AS `name`
FROM collection2 c
LEFT OUTER JOIN coll2_man m ON c.`m_id`=m.`id`
LEFT OUTER JOIN coll2_cat k ON c.`c_id`=k.`c_id`
LEFT OUTER JOIN coll2_struct s ON c.`struct_id`=s.`id`
LEFT OUTER JOIN (SELECT id,struct_".$lang." FROM coll2_struct WHERE parent=id) p ON p.`id`=s.`parent`
WHERE p.`id` IS NOT NULL AND m.deleted=0 AND c.deleted=0 AND k.deleted=0 ".
((is_array($types)&&count($types))?" AND c.tipus IN ('".implode("','",$types)."')":"").
((is_array($brands)&&count($brands))?" AND c.m_id IN (".implode(",",$brands).")":"").
"
ORDER BY p.`struct_".$lang."`;");
$this->categories=$db->loadObjectList();
return $this->categories;
}
public function getSubcategories($types=array(),$brands=array(),$categories=array())
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("
SELECT DISTINCT(s.`id`) AS `id`,s.`struct_".$lang."` AS `name`
FROM collection2 c
LEFT OUTER JOIN coll2_man m ON c.`m_id`=m.`id`
LEFT OUTER JOIN coll2_cat k ON c.`c_id`=k.`c_id`
LEFT OUTER JOIN coll2_struct s ON c.`struct_id`=s.`id`
LEFT OUTER JOIN (SELECT id,struct_".$lang." FROM coll2_struct WHERE parent=id) p ON p.`id`=s.`parent`
WHERE p.`id` IS NOT NULL AND m.deleted=0 AND c.deleted=0 AND k.deleted=0 ".
((is_array($types)&&count($types))?" AND c.tipus IN ('".implode("','",$types)."')":"").
((is_array($brands)&&count($brands))?" AND c.m_id IN (".implode(",",$brands).")":"").
((is_array($categories)&&count($categories))?" AND s.parent IN (".implode(",",$categories).")":"").
"
ORDER BY s.`struct_".$lang."`;");
$this->subcategories=$db->loadObjectList();
return $this->subcategories;
}
public function getPlaceholder($type="sr_type",$value)
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->placeholder))
{
$db=JFactory::getDBO();
switch ($type)
{
case 'sr_type' :
{
$db->setQuery("SELECT `name_".$lang."` AS `name` FROM coll2_types WHERE `type`='".$value."' LIMIT 1;");
$tmp=$db->loadObjectList();
break;
}
case 'sr_manufacture' :
{
$db->setQuery("SELECT `name` AS `name` FROM coll2_man WHERE `id`='".$value."' LIMIT 1;");
$tmp=$db->loadObjectList();
break;
}
}
$this->placeholder=(isset($tmp[0]->name) ? $tmp[0]->name : "");
}
return $this->placeholder;
}
public function getPrVersion()
{
$ret=2012;
if (!isset($this->prversion) || (int)$this->prversion==0)
{
$db=JFactory::getDBO();
$session=&JFactory::getSession();
$ver=(int)$session->get('sr_ver');
if ($ver)
{
$db->setQuery("SELECT * FROM coll2_prversion WHERE ver=".$ver);
$row=$db->loadObjectList();
if (!empty($row)) $ret=(int)$row[0]->prversion;
}
$this->prversion=$ret;
}
else
{
$ret=$this->prversion;
}
return ($ret);
}
public function getArticle($alias='showroom')
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM #__content WHERE alias='".$alias."' LIMIT 1;");
$tmp=$db->loadObjectList();
$this->article=$tmp[0];
return $this->article;
}
public function getProduct($product=0)
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');
if (!isset($this->product) && (int)$product>0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT
x.o_id AS id,x.title_".$lang." AS `title`,IF( LENGTH(x.title_".$lang.")>20,CONCAT(SUBSTRING(x.title_".$lang.",1,18),'...'),x.title_".$lang.") AS `title_short`,
x.desc_".$lang." AS `desc`,CONCAT('/".$this->getProductThumb()."/',m.dir,'/',x.o_id,'/zz_big.jpg') AS img,v.file,v.version,
x.rendelheto,x.`show`,x.`down`,x.tipus,t.type_download,x.deleted,x.m_id,m.`name` AS m_name,m.dir,m.deleted AS m_deleted,
x.c_id,c.nev_".$lang." AS c_name,c.nev_eng AS c_name_eng,IF( LENGTH(c.nev_".$lang.")>15,CONCAT(SUBSTRING(c.nev_".$lang.",1,13),'...'),c.nev_".$lang.") AS `c_name_short`,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
LEFT OUTER JOIN coll2_types t ON x.tipus=t.type
LEFT OUTER JOIN (SELECT ver_id,o_id,fajl AS file,version FROM coll2_ver WHERE o_id=".(int)$product." AND version<=".$this->getPrVersion()." ORDER BY version DESC LIMIT 1) v ON x.o_id=v.o_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 AND x.o_id=".(int)$product." LIMIT 1;");
$tmp = $db->loadObjectList();
$this->product = $tmp[0];
}
return $this->product;
}
public function getFiles($id=0)
{
if ((int)$id<=0) return(FALSE);
$this->folder=$this->getFullPath($id);
if (is_dir($this->folder)) $this->files=$this->getFilteredFiles(scandir($this->folder),$id);
return $this->files;
}
public function getFilteredFiles($tomb=array(),$id)
{
$ret=array();
$this->filter=array('.','..','.quarantine');
if (is_array($tomb) and count($tomb))
{
foreach ($tomb as $file)
{
if (!in_array($file, $this->filter))
{
$parts=explode(".", $file);
$obj=new stdClass;
$obj->name=$file;
$obj->path=$this->getPath($id).$file;
$obj->fullpath=$_SERVER['DOCUMENT_ROOT'].$obj->path;
$obj->extension=(in_array(strtolower(end($parts)),$this->arrKnownFiles) ? strtolower(end($parts)) : 'unknown');
$obj->filesize=filesize($obj->fullpath);
$obj->datetime=filemtime($obj->fullpath);
$obj->icon='/components/com_showroom/assets/images/'.$obj->extension.'.png';
$obj->multidownloadlink=($obj->extension=='pdf' ? $obj->path : $this->getMultiDownloadLink($id,$obj->path));
$ret[]=$obj;
}
}
}
return $ret;
}
public function getPath($id=0)
{
$path='';
if ((int)$id>0)
{
$itm=$this->getProduct($id);
$path='/'.$this->productDir.'/'.$itm->dir.'/'.(int)$id.'/';
}
return $path;
}
public function getFullPath($id=0)
{
$path='';
if ((int)$id>0) { $path=$_SERVER['DOCUMENT_ROOT'].$this->getPath($id); }
return $path;
}
public function getMultiDownloadLink($id,$path)
{
$ret="";
$obj=$this->getProduct($id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
/*
$fajlok=@scandir($this->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=$obj->file; }
else { $f=$fajlok[2]; }
*/
if ($path>"")
{
$ret=$path."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($this->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
((int)$_SESSION['__default']['sr_ver']>=32 ? '&multi='.($_SESSION['__default']['sr_multi']>'' ? $_SESSION['__default']['sr_multi'] : 'false') : '');
if ((int)$_SESSION['__default']['sr_ver']>=33)
{
$struct=$this->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getStruct($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT s.`id`,s.`struct_eng` AS `subcategory`,s.`parent` AS `parent_id`,p.`struct_eng` AS `category`
FROM coll2_struct s
LEFT OUTER JOIN (SELECT * FROM coll2_struct WHERE parent=id) p ON s.parent=p.id
WHERE s.id=(SELECT struct_id FROM collection2 WHERE o_id=".(int)$id.") LIMIT 1;");
$tmp=$db->loadObjectList();
$this->struct=$tmp[0];
return($this->struct);
}
public function getProductThumb() { return $this->productThumb; }
public function getProductDir() { return $this->productDir; }
public function getAll() { return $this->all; }
public function getIPP() { return $this->ipp; }
public function getPage() { return $this->page; }
public function getLast() { return $this->last; }
public function getFirst() { return $this->first; }
public function getPager() { return $this->pager; }
public function getVisibleLast() { return $this->visibleLast; }
public function getVisibleFirst() { return $this->visibleFirst; }
public function getLang()
{
return (JFactory::getLanguage()->getTag()=='hu-HU' ? "hun" : "eng");
}
}
?>

View File

@ -0,0 +1,252 @@
<?php
defined('_JEXEC') or die('Restricted access'); // No direct access to this file
jimport('joomla.application.component.modelitem'); // import Joomla modelitem library
class ShowroomModelUploadGroup extends JModelItem
{
protected $types;
protected $manufacture;
protected $manufactures;
protected $family;
protected $families;
protected $querystring;
protected $parents;
protected $parent;
protected $subcat;
protected $lang;
public function getTypes()
{
$session=&JFactory::getSession();
$lang=$session->get( 'sr_lang');//'hun';
if (!isset($this->types))
{
$db = JFactory::getDBO();
$db->setQuery("
SELECT `type`,`type_download`,`name_".$lang."` AS `name`,IF(LENGTH(name_".$lang.")>15,CONCAT(SUBSTRING(name_".$lang.",1,13),'...'),name_".$lang.") AS name_short, `desc_".$lang."` AS `desc`,REPLACE('".$this->typePath."','REPLACE',`type`) AS `img`,c.darab
FROM coll2_types t
LEFT OUTER JOIN (
SELECT COUNT(*) AS darab,x.tipus FROM (
SELECT x.o_id,x.tipus,x.deleted,x.m_id,m.`name` AS m_name,m.deleted AS m_deleted,x.c_id,c.nev_hun AS c_name,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0
) x GROUP BY x.tipus
) c ON c.tipus=t.`type`
WHERE c.darab>0
ORDER BY `name_".$lang."`;");
$this->types = $db->loadObjectList();
}
return $this->types;
}
public function getManufactures($type="")
{
$session=&JFactory::getSession();
$lang=$session->get( 'sr_lang');//'hun';
if (!isset($this->manufactures))
{
$db = JFactory::getDBO();
$db->setQuery("
SELECT id,group_id,name,IF( LENGTH(name)>16,CONCAT(SUBSTRING(name,1,14),'...'),name) AS name_short,dir,deleted,REPLACE('".$this->logoPath."','REPLACE',`dir`) AS logo,cnt.darab
FROM coll2_man m
LEFT OUTER JOIN (
SELECT COUNT(*) AS darab,m_id,m_name FROM (
SELECT x.o_id,x.tipus,x.deleted,x.m_id,m.`name` AS m_name,m.deleted AS m_deleted,x.c_id,c.nev_hun AS c_name,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".($type>'' ? "AND tipus='".$type."'" : "")."
) x GROUP BY m_id
) cnt ON cnt.m_id=m.id
WHERE cnt.darab>0
ORDER BY name;");
$this->manufactures = $db->loadObjectList();
}
return $this->manufactures;
}
public function getManufacture($id=0)
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM coll2_man m WHERE id=".$id." LIMIT 1;");
$tmp=$db->loadObjectList();;
$this->manufacture=$tmp[0];
return $this->manufacture;
}
public function getManufactureByName($name="")
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM coll2_man m WHERE name='".$name."' LIMIT 1;");
$tmp=$db->loadObjectList();;
$this->manufacture=$tmp[0];
return $this->manufacture;
}
public function getFamilies($type="",$manufacture="")
{
$session=&JFactory::getSession();
$lang=$session->get( 'sr_lang');//'hun';
if (!isset($this->families))
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT f.c_id,f.m_id,m.`name` AS manufacure,IF( LENGTH(f.nev_".$lang.")>15,CONCAT(SUBSTRING(f.nev_".$lang.",1,13),'...'),f.nev_".$lang.") AS family_short,f.nev_".$lang." AS family,cnt.darab
FROM coll2_cat f
LEFT OUTER JOIN (
SELECT COUNT(*) AS darab,c_id,c_name FROM (
SELECT x.o_id,x.tipus,x.deleted,x.m_id,m.`name` AS m_name,m.deleted AS m_deleted,x.c_id,c.nev_hun AS c_name,c.deleted AS c_deleted
FROM collection2 x
LEFT OUTER JOIN coll2_man m ON x.m_id=m.id
LEFT OUTER JOIN coll2_cat c ON x.c_id=c.c_id
WHERE x.deleted=0 AND m.deleted=0 AND c.deleted=0 ".($type>'' ? "AND tipus='".$type."'" : "")." ".((int)$manufacture>0 ? "AND x.m_id='".(int)$manufacture."'" : "")."
) x GROUP BY c_id
) cnt ON cnt.c_id=f.c_id
LEFT OUTER JOIN coll2_man m ON m.id=f.m_id
WHERE cnt.darab>0
ORDER BY f.nev_".$lang.";");
$this->families = $db->loadObjectList();
}
return $this->families;
}
public function getFamily($id=0)
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("SELECT c_id,m_id,nev_".$lang." AS name,deleted FROM coll2_cat WHERE c_id=".$id." LIMIT 1;");
$tmp=$db->loadObjectList();
$this->family=$tmp[0];
return $this->family;
}
public function getFamilyByName($name="",$m_id=0)
{
$session=&JFactory::getSession();
$lang=$session->get('sr_lang');//'hun';
$db=JFactory::getDBO();
$db->setQuery("SELECT c_id,m_id,nev_".$lang." AS name,deleted FROM coll2_cat WHERE ".((int)$m_id>0 ? 'm_id='.$m_id.' AND ' : '')." (nev_hun='".$name."' OR nev_eng='".$name."') LIMIT 1;");
$tmp=$db->loadObjectList();
$this->family=$tmp[0];
return $this->family;
}
public function saveRecord($tomb=array())
{
$newID=0;
$collection2=new stdClass();
$collection2->m_id=$tomb['m_id'];
$collection2->desc_hun=$tomb['desc_hun'];
$collection2->desc_eng=$tomb['desc_eng'];
$collection2->c_id=$tomb['c_id'];
$collection2->struct_id=$tomb['struct_id'];
$collection2->datum=date("Y-m-d H:i:s",time());
$collection2->title_hun=$tomb['title_hun'];
$collection2->title_eng=$tomb['title_eng'];
$collection2->tipus=$tomb['tipus'];
$collection2->rendelheto=1;
$collection2->show=0;
$collection2->down=0;
$collection2->deleted=$tomb['deleted'];
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM collection2 WHERE tipus='".$collection2->tipus."' AND m_id=".$collection2->m_id." AND c_id=".$collection2->c_id." AND title_hun='".$collection2->title_hun."' LIMIT 1;");
$exist=$db->loadObjectList();
if (count($exist))
{
$newID=$exist[0]->o_id;
}
else
{
if (JFactory::getDbo()->insertObject('collection2', $collection2)==TRUE)
$newID=JFactory::getDbo()->insertid();
}
if ($newID)
{
$coll2_desc_eng=New stdClass();
$coll2_desc_eng->o_id=$newID;
$coll2_desc_eng->lang='eng';
$coll2_desc_eng->title=$tomb['title_eng'];
$coll2_desc_eng->desc=$tomb['desc_eng'];
JFactory::getDbo()->insertObject('coll2_desc', $coll2_desc_eng);
$coll2_desc_hun=New stdClass();
$coll2_desc_hun->o_id=$newID;
$coll2_desc_hun->lang='hun';
$coll2_desc_hun->title=$tomb['title_hun'];
$coll2_desc_hun->desc=$tomb['desc_hun'];
JFactory::getDbo()->insertObject('coll2_desc', $coll2_desc_hun);
$coll2_ver=New stdClass();
$coll2_ver->o_id=$newID;
$coll2_ver->fajl=$tomb['fajl'];
$coll2_ver->version=$tomb['version'];
$coll2_ver->down=0;
$coll2_ver->deleted=0;
JFactory::getDbo()->insertObject('coll2_ver', $coll2_ver);
}
return($newID);
}
public function getParents()
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT id,t.`name_".$this->getLang()."` AS `type`,struct_".$this->getLang()." AS `name`
FROM coll2_struct s
LEFT OUTER JOIN `coll2_types` t ON t.`type` COLLATE utf8_unicode_ci=s.`type`
WHERE parent=id
ORDER BY t.`name_".$this->getLang()."`,s.ord,s.`struct_".$this->getLang()."`;");
$this->parents=$db->loadObjectList();
return $this->parents;
}
public function getParentByName($tipus,$parent)
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM coll2_struct WHERE LOWER(type)='".strtolower($tipus)."' AND parent=id AND LOWER(struct_eng)='".strtolower($parent)."' LIMIT 1;");
$tmp=$db->loadObjectList();
$this->parent=$tmp[0];
return $this->parent;
}
public function getSubcat($parent=-1)
{
$db=JFactory::getDBO();
$db->setQuery("
SELECT s.`id`,t.`name_".$this->getLang()."` AS `type`,p.`parent`,s.`struct_".$this->getLang()."` AS `name`
FROM `coll2_struct` s
LEFT OUTER JOIN `coll2_types` t ON t.`type` COLLATE utf8_unicode_ci=s.`type`
LEFT OUTER JOIN (SELECT id,struct_".$this->getLang()." AS `parent` FROM coll2_struct WHERE parent=id) p ON p.`id`=s.`parent`
WHERE s.`parent`!=s.`id` ".($parent==-1 ? "" : "AND s.`parent`=".(int)$parent)."
ORDER BY p.`parent`,s.ord,s.`struct_".$this->getLang()."`;");
$this->subcat=$db->loadObjectList();
return $this->subcat;
}
public function getSubcatByName($tipus,$parent_id,$subcat)
{
$db=JFactory::getDBO();
$db->setQuery("SELECT * FROM coll2_struct WHERE LOWER(type)='".strtolower($tipus)."' AND parent=".$parent_id." AND LOWER(struct_eng)='".strtolower($subcat)."';");
$tmp=$db->loadObjectList();
$this->subcat=$tmp[0];
return $this->subcat;
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=(strpos($_SERVER['HTTP_HOST'],".com") ? "eng" : "hun"); }
return $this->lang;
}
}
?>

View File

@ -1,131 +1,131 @@
<?php defined('_JEXEC') or die; ?>
<div class="container">
<div class="row">
<?php if (!isset($this->sess['sr_template'])) : ?>
<?= $this->article->introtext ?>
<?= $this->article->fulltext ?>
<?php endif; ?>
<div class="showroom_search">
<div class="showroom_back">
<a href="/index.php?option=com_showroom&view=showroom&family=none<?= ($this->sess['sr_type'] > '' ? '&type=' . $this->sess['sr_type'] : '') . ((int)$this->sess['sr_manufacture'] > 0 ? '&manufacture=' . $this->sess['sr_manufacture'] : '') . $this->querystring ?>" title="<?= JText::_(COM_SHOWROOM_BACK); ?>">
<img src="/components/com_showroom/assets/images/back_1.png" alt="<?= JText::_(COM_SHOWROOM_BACK); ?>" title="<?= JText::_(COM_SHOWROOM_BACK); ?>" />
</a>
</div>
<form name="showroom_search" id="showroom_search" method="post" action="index.php?option=com_showroom&view=search<?= $this->querystring ?>">
<input type="text" name="showroom_keyword" id="showroom_keyword" placeholder="<?= JText::_(COM_SHOWROOM_SEARCH); ?>..." />
</form>
<?php if ($this->sess['sr_ver'] >= 32 && $this->sess['sr_template'] == 'blankframe') : ?>
<div class="showroom_multi">
<input type="checkbox" name="multi" id="multi" <?= ($this->sess['sr_multi'] == 'true' ? 'checked="checked"' : '') ?> />
<label for="multi"><span></span>&nbsp;<?= JText::_(COM_SHOWROOM_MULTI_DOWNLOAD); ?></label>
</div>
<?php endif; ?>
</div>
<div class="showroom_clear"></div>
<div class="family_menu">
<h4><?= $this->families[0]->manufacture ?></h4>
<ul>
<?php foreach ($this->families as $family) : ?>
<li>
<?php if ($family->c_id == $this->sess['sr_family']) : ?>
<span class="active"><?= $family->family_short ?> (<?= $family->darab ?>)</span>
<?php else : ?>
<a href="index.php?option=com_showroom&view=family&family=<?= $family->c_id ?><?= $this->querystring ?>">
<?= $family->family_short ?> (<?= $family->darab ?>)
</a>
<?php endif; ?>
</li>
<? endforeach; ?>
</ul>
</div>
<div class="family_container">
<?php foreach ($this->products as $product) : ?>
<div class="paddingBottom10">
<div id="product_<?= $product->id ?>" class="contentBox <?= ($this->sess['sr_product'] == $product->id ? "active" : "inactive") ?>">
<div class="image">
<a href="/index.php?option=com_showroom&view=product&product=<?= $product->id ?><?= $this->querystring ?>">
<img src="<?= $product->img ?>" alt="<?= $product->title ?>" title="<?= $product->title ?>" />
<div class="description<?= ($this->sess['sr_product'] == $product->id ? "_active" : "") ?>"><span class="description_description"><?= $product->title_short ?></span></div>
</a>
<?php
//$letoltlink=(isset($this->sess['sr_template']) ? $this->getDownloadLink($product) : '');
$letoltlink = $this->getDownloadLink($product);
if ($letoltlink > "") : ?>
<?php
$letoltlink = (isset($this->sess['sr_template']) ? 'http://www.archline.hu/' . $letoltlink : $letoltlink);
?>
<?php if (count($this->files[$product->id]) > 1 && $this->sess['sr_ver'] >= 33) : ?>
<div id="smallDownloadPanelContainer-<?= $product->id ?>" class="smallDownloadPanelContainer" style="display:none;">
<table border="0" cellspacing="1" cellpadding="1">
<?php foreach ($this->files[$product->id] as $file) : ?>
<?php if ($file->extension != 'unknown') : ?>
<tr>
<td><img src="<?= $file->icon ?>" border="0" /></td>
<td align="left"><a href="<?= $file->multidownloadlink ?>" class="letoltlink" rel="<?= $this->product->id ?>"><?= JText::_("COM_SHOWROOM_" . $file->extension); ?></a></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
<span class="description_download dd_pos1">
<img src="/components/com_showroom/assets/images/icon-download.png" alt="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" title="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" onclick="javascript:clickSmallButton(<?= $product->id ?>);" />
</span>
<?php else : ?>
<span class="description_download dd_pos1">
<a href="<?= $letoltlink ?>" class="letoltlink" rel="<?= $product->id ?>">
<img src="/components/com_showroom/assets/images/icon-download.png" alt="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" title="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" />
</a>
</span>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
<? endforeach; ?>
</div>
</div>
</div>
<?php if (!isset($this->sess['sr_template'])) : ?>
<div class="container">
<div class="row">&nbsp;</div>
</div>
<?php endif; ?>
<?php if (isset($this->sess['sr_template'])) : ?>
<div id="result"></div>
<script type="text/javascript">
jQuery('.letoltlink').click(function() {
jQuery.ajax({
type: "GET",
url: '/components/com_showroom/assets/ajax/AjaxDownloadController.class.php',
data: 'o_id=' + jQuery(this).attr('rel'),
success: function(html) {
jQuery('#result').html(html);
}
});
});
jQuery('#multi').click(function() {
jQuery(location).attr('href', '<?= (strpos(JFactory::getURI()->toString(), 'multi=') > 0 ? substr(JFactory::getURI()->toString(), 0, strpos(JFactory::getURI()->toString(), 'multi=') - 1) : JFactory::getURI()->toString()) ?>&multi=' + (jQuery('#multi').is(':checked') ? 'true' : 'false'));
});
function clickSmallButton(id) {
var isVisible = jQuery("#smallDownloadPanelContainer-" + id).is(":visible");
jQuery(".smallDownloadPanelContainer").hide(200);
if (isVisible == false) jQuery("#smallDownloadPanelContainer-" + id).show(200);
}
</script>
<?php defined('_JEXEC') or die; ?>
<div class="container">
<div class="row">
<?php if (!isset($this->sess['sr_template'])) : ?>
<?= $this->article->introtext ?>
<?= $this->article->fulltext ?>
<?php endif; ?>
<div class="showroom_search">
<div class="showroom_back">
<a href="/index.php?option=com_showroom&view=showroom&family=none<?= ($this->sess['sr_type'] > '' ? '&type=' . $this->sess['sr_type'] : '') . ((int)$this->sess['sr_manufacture'] > 0 ? '&manufacture=' . $this->sess['sr_manufacture'] : '') . $this->querystring ?>" title="<?= JText::_(COM_SHOWROOM_BACK); ?>">
<img src="/components/com_showroom/assets/images/back_1.png" alt="<?= JText::_(COM_SHOWROOM_BACK); ?>" title="<?= JText::_(COM_SHOWROOM_BACK); ?>" />
</a>
</div>
<form name="showroom_search" id="showroom_search" method="post" action="index.php?option=com_showroom&view=search<?= $this->querystring ?>">
<input type="text" name="showroom_keyword" id="showroom_keyword" placeholder="<?= JText::_(COM_SHOWROOM_SEARCH); ?>..." />
</form>
<?php if ($this->sess['sr_ver'] >= 32 && $this->sess['sr_template'] == 'blankframe') : ?>
<div class="showroom_multi">
<input type="checkbox" name="multi" id="multi" <?= ($this->sess['sr_multi'] == 'true' ? 'checked="checked"' : '') ?> />
<label for="multi"><span></span>&nbsp;<?= JText::_(COM_SHOWROOM_MULTI_DOWNLOAD); ?></label>
</div>
<?php endif; ?>
</div>
<div class="showroom_clear"></div>
<div class="family_menu">
<h4><?= $this->families[0]->manufacture ?></h4>
<ul>
<?php foreach ($this->families as $family) : ?>
<li>
<?php if ($family->c_id == $this->sess['sr_family']) : ?>
<span class="active"><?= $family->family_short ?> (<?= $family->darab ?>)</span>
<?php else : ?>
<a href="index.php?option=com_showroom&view=family&family=<?= $family->c_id ?><?= $this->querystring ?>">
<?= $family->family_short ?> (<?= $family->darab ?>)
</a>
<?php endif; ?>
</li>
<? endforeach; ?>
</ul>
</div>
<div class="family_container">
<?php foreach ($this->products as $product) : ?>
<div class="paddingBottom10">
<div id="product_<?= $product->id ?>" class="contentBox <?= ($this->sess['sr_product'] == $product->id ? "active" : "inactive") ?>">
<div class="image">
<a href="/index.php?option=com_showroom&view=product&product=<?= $product->id ?><?= $this->querystring ?>">
<img src="<?= $product->img ?>" alt="<?= $product->title ?>" title="<?= $product->title ?>" />
<div class="description<?= ($this->sess['sr_product'] == $product->id ? "_active" : "") ?>"><span class="description_description"><?= $product->title_short ?></span></div>
</a>
<?php
//$letoltlink=(isset($this->sess['sr_template']) ? $this->getDownloadLink($product) : '');
$letoltlink = $this->getDownloadLink($product);
if ($letoltlink > "") : ?>
<?php
$letoltlink = (isset($this->sess['sr_template']) ? 'http://www.archline.hu/' . $letoltlink : $letoltlink);
?>
<?php if (count($this->files[$product->id]) > 1 && $this->sess['sr_ver'] >= 33) : ?>
<div id="smallDownloadPanelContainer-<?= $product->id ?>" class="smallDownloadPanelContainer" style="display:none;">
<table border="0" cellspacing="1" cellpadding="1">
<?php foreach ($this->files[$product->id] as $file) : ?>
<?php if ($file->extension != 'unknown') : ?>
<tr>
<td><img src="<?= $file->icon ?>" border="0" /></td>
<td align="left"><a href="<?= $file->multidownloadlink ?>" class="letoltlink" rel="<?= $this->product->id ?>"><?= JText::_("COM_SHOWROOM_" . $file->extension); ?></a></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
<span class="description_download dd_pos1">
<img src="/components/com_showroom/assets/images/icon-download.png" alt="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" title="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" onclick="javascript:clickSmallButton(<?= $product->id ?>);" />
</span>
<?php else : ?>
<span class="description_download dd_pos1">
<a href="<?= $letoltlink ?>" class="letoltlink" rel="<?= $product->id ?>">
<img src="/components/com_showroom/assets/images/icon-download.png" alt="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" title="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" />
</a>
</span>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
<? endforeach; ?>
</div>
</div>
</div>
<?php if (!isset($this->sess['sr_template'])) : ?>
<div class="container">
<div class="row">&nbsp;</div>
</div>
<?php endif; ?>
<?php if (isset($this->sess['sr_template'])) : ?>
<div id="result"></div>
<script type="text/javascript">
jQuery('.letoltlink').click(function() {
jQuery.ajax({
type: "GET",
url: '/components/com_showroom/assets/ajax/AjaxDownloadController.class.php',
data: 'o_id=' + jQuery(this).attr('rel'),
success: function(html) {
jQuery('#result').html(html);
}
});
});
jQuery('#multi').click(function() {
jQuery(location).attr('href', '<?= (strpos(JFactory::getURI()->toString(), 'multi=') > 0 ? substr(JFactory::getURI()->toString(), 0, strpos(JFactory::getURI()->toString(), 'multi=') - 1) : JFactory::getURI()->toString()) ?>&multi=' + (jQuery('#multi').is(':checked') ? 'true' : 'false'));
});
function clickSmallButton(id) {
var isVisible = jQuery("#smallDownloadPanelContainer-" + id).is(":visible");
jQuery(".smallDownloadPanelContainer").hide(200);
if (isVisible == false) jQuery("#smallDownloadPanelContainer-" + id).show(200);
}
</script>
<?php endif; ?>

View File

@ -1,228 +1,228 @@
<?php defined('_JEXEC') or die; ?>
<?php
/*
$user=JFactory::getUser();
if ($user->id==568)
{
print_r($this->url);
print "<br />";
}
*/
?>
<div class="container">
<div class="row">
<?php if (!isset($this->sess['sr_template'])) : ?>
<?= $this->article->introtext ?>
<?= $this->article->fulltext ?>
<?php endif; ?>
<div class="showroom_search">
<div class="showroom_back">
<?php
$backlink = (isset($_GET['from']) && trim(strtolower($_GET['from'])) == 'search' ? 'search' : 'family&family=' . $this->sess['sr_family'] . $this->querystring);
?>
<a href="/index.php?option=com_showroom&view=<?= $backlink ?>" title="<?= JText::_(COM_SHOWROOM_BACK); ?>">
<img src="/components/com_showroom/assets/images/back_2.png" alt="<?= JText::_(COM_SHOWROOM_BACK); ?>" title="<?= JText::_(COM_SHOWROOM_BACK); ?>" />
</a>
</div>
<form name="showroom_search" id="showroom_search" method="post" action="index.php?option=com_showroom&view=search<?= $this->querystring ?>">
<input type="text" name="showroom_keyword" id="showroom_keyword" placeholder="<?= JText::_(COM_SHOWROOM_SEARCH); ?>..." />
</form>
<?php if ($this->sess['sr_ver'] >= 32 && $this->sess['sr_template'] == 'blankframe') : ?>
<div class="showroom_multi">
<input type="checkbox" name="multi" id="multi" <?= ($this->sess['sr_multi'] == 'true' ? 'checked="checked"' : '') ?> />
<label for="multi"><span></span>&nbsp;<?= JText::_(COM_SHOWROOM_MULTI_DOWNLOAD); ?></label>
</div>
<?php endif; ?>
</div>
<div class="showroom_clear"></div>
<div class="family_menu">
<h4><?= $this->families[0]->manufacture ?></h4>
<ul>
<?php foreach ($this->families as $family) : ?>
<li>
<?php if ($family->c_id == $this->sess['sr_family']) : ?>
<span class="active"><?= $family->family ?> (<?= $family->darab ?>)</span>
<?php else : ?>
<a href="index.php?option=com_showroom&view=family&family=<?= $family->c_id ?>&product=none<?= $this->querystring ?>">
<?= $family->family_short ?> (<?= $family->darab ?>)
</a>
<?php endif; ?>
</li>
<? endforeach; ?>
</ul>
</div>
<div class="product_container">
<div class="product_image_<?= (isset($this->sess['sr_template']) ? 'narrow' : 'full') ?>">
<img src="<?= $this->product->img ?>" id="img_<?= $this->product->id ?>" alt="<?= $this->product->title ?>" title="<?= $this->product->title ?>" border="0" />
</div>
<div class="product_description <?= (isset($this->sess['sr_template']) ? 'narrow' : 'full') ?>">
<h5><?= $this->product->c_name ?></h5>
<h6><?= $this->product->title ?></h6>
<div style="width:420px;height:245px;overflow:auto;">
<p>
<?php
if (strpos($this->product->desc, "#") !== FALSE) {
$miket = array('#kep_moshato#', '#kep_nem_moshato2#', '#kep_nem_moshato#', '#kep_moshato2#');
$mikre = array(
'<img src="/public/img/collection/kep_moshato.png" />',
'<img src="/public/img/collection/kep_nem_moshato.png" />',
'<img src="/public/img/collection/kep_nem_moshato_alap.png" />',
'<img src="/public/img/collection/kep_moshato2.png" />'
);
$this->product->desc = str_replace($miket, $mikre, $this->product->desc);
}
echo nl2br($this->product->desc);
?></p>
</div>
<p><i><?= JText::_(COM_SHOWROOM_DOWNLOADS); ?>: <strong><?= $this->product->down ?></strong> <?= JText::_(COM_SHOWROOM_VIEWS); ?>: <strong><?= $this->product->show ?></strong></i></p>
<?php
//$letoltlink=(isset($this->sess['sr_template']) ? $this->getDownloadLink($this->product) : '');
$letoltlink = $this->getDownloadLink($this->product);
if ($letoltlink > "") : ?>
<?php
$letoltlink = (isset($this->sess['sr_template']) ? 'http://www.archline.hu/' . $letoltlink : $letoltlink);
?>
<?php if (count($this->files[$this->product->id]) > 1 && $this->sess['sr_ver'] >= 33) : ?>
<div id="downloadButton" class="product_download"><?= JText::_(COM_SHOWROOM_DOWNLOAD); ?></div>
<div id="downloadPanelContainer" style="display:none;">
<table border="0" cellspacing="1" cellpadding="1">
<?php foreach ($this->files[$this->product->id] as $file) : ?>
<?php if ($file->extension != 'unknown') : ?>
<tr>
<td><img src="<?= $file->icon ?>" border="0" /></td>
<td align="left"><a href="<?= $file->multidownloadlink ?>" class="letoltlink" rel="<?= $this->product->id ?>"><?= JText::_("COM_SHOWROOM_" . $file->extension); ?></a></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
<?php else : ?>
<a href="<?= $letoltlink ?>" class="letoltlink" rel="<?= $this->product->id ?>">
<div class="product_download"><?= JText::_(COM_SHOWROOM_DOWNLOAD); ?></div>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="showroom_clear"></div>
<div class="product_scroller" style="padding-top:6px;">
<div class="showroom_container">
<div class="showroom_title showroom_title_level1"><span class="showroom_title_description" style="padding-left:5px;"><?= $this->product->c_name_short ?> (<?= count($this->products) ?>)</span></div>
<div id="makeMeScrollable_1" class="makeMeScrollable">
<?php foreach ($this->products as $product) : ?>
<div id="product_<?= $product->id ?>" class="contentBox <?= ($this->sess['sr_product'] == $product->id ? "active" : "inactive") ?>">
<div class="image">
<?php
$backlink = (isset($_GET['from']) && trim(strtolower($_GET['from'])) == 'search' ? '&from=search' : '');
?>
<a href="/index.php?option=com_showroom&view=product&product=<?= $product->id ?><?= $backlink ?><?= $this->querystring ?>">
<img src="<?= $product->img ?>" alt="<?= $product->title ?>" title="<?= $product->title ?>" />
<div class="description<?= ($this->sess['sr_product'] == $product->id ? "_active" : "") ?>"><span class="description_description"><?= $product->title_short ?></span></div>
</a>
<?php
$letoltlink = (isset($this->sess['sr_template']) ? $this->getDownloadLink($product) : '');
if ($letoltlink > "") : ?>
<?php if (count($this->files[$product->id]) > 1 && $this->sess['sr_ver'] >= 33) : ?>
<div id="smallDownloadPanelContainer-<?= $product->id ?>" class="smallDownloadPanelContainer" style="display:none;">
<table border="0" cellspacing="1" cellpadding="1">
<?php foreach ($this->files[$product->id] as $file) : ?>
<?php if ($file->extension != 'unknown') : ?>
<tr>
<td><img src="<?= $file->icon ?>" border="0" /></td>
<td align="left"><a href="<?= $file->multidownloadlink ?>" class="letoltlink" rel="<?= $this->product->id ?>"><?= JText::_("COM_SHOWROOM_" . $file->extension); ?></a></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
<span class="description_download dd_pos1">
<img src="/components/com_showroom/assets/images/icon-download.png" alt="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" title="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" onclick="javascript:clickSmallButton(<?= $product->id ?>);" />
</span>
<?php else : ?>
<span class="description_download dd_pos1">
<a href="<?= $letoltlink ?>" class="letoltlink" rel="<?= $product->id ?>">
<img src="/components/com_showroom/assets/images/icon-download.png" alt="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" title="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" />
</a>
</span>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<? endforeach; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if (!isset($this->sess['sr_template'])) : ?>
<div class="container">
<div class="row">&nbsp;</div>
</div>
<?php endif; ?>
<?php if (isset($this->sess['sr_template'])) : ?>
<div id="result"></div>
<script type="text/javascript">
jQuery('.letoltlink').click(function() {
jQuery.ajax({
type: "GET",
url: '/components/com_showroom/assets/ajax/AjaxDownloadController.class.php',
data: 'o_id=' + jQuery(this).attr('rel'),
success: function(html) {
jQuery('#result').html(html);
}
});
});
</script>
<?php endif; ?>
<script type="text/javascript">
jQuery(document).ready(function() {
function() {
jQuery("#makeMeScrollable_1").smoothDivScroll({
mousewheelScrolling: "allDirections",
manualContinuousScrolling: true,
autoScrollingMode: "onStart"
});
};
});
jQuery('#multi').click(function() {
jQuery(location).attr('href', '<?= (strpos(JFactory::getURI()->toString(), 'multi=') > 0 ? substr(JFactory::getURI()->toString(), 0, strpos(JFactory::getURI()->toString(), 'multi=') - 1) : JFactory::getURI()->toString()) ?>&multi=' + (jQuery('#multi').is(':checked') ? 'true' : 'false'));
});
jQuery("#downloadButton").click(function() {
jQuery(".smallDownloadPanelContainer").hide(200);
jQuery("#downloadPanelContainer").toggle(200);
});
function clickSmallButton(id) {
var isVisible = jQuery("#smallDownloadPanelContainer-" + id).is(":visible");
jQuery("#downloadPanelContainer").hide(200);
jQuery(".smallDownloadPanelContainer").hide(200);
if (isVisible == false) jQuery("#smallDownloadPanelContainer-" + id).show(200);
}
<?php defined('_JEXEC') or die; ?>
<?php
/*
$user=JFactory::getUser();
if ($user->id==568)
{
print_r($this->url);
print "<br />";
}
*/
?>
<div class="container">
<div class="row">
<?php if (!isset($this->sess['sr_template'])) : ?>
<?= $this->article->introtext ?>
<?= $this->article->fulltext ?>
<?php endif; ?>
<div class="showroom_search">
<div class="showroom_back">
<?php
$backlink = (isset($_GET['from']) && trim(strtolower($_GET['from'])) == 'search' ? 'search' : 'family&family=' . $this->sess['sr_family'] . $this->querystring);
?>
<a href="/index.php?option=com_showroom&view=<?= $backlink ?>" title="<?= JText::_(COM_SHOWROOM_BACK); ?>">
<img src="/components/com_showroom/assets/images/back_2.png" alt="<?= JText::_(COM_SHOWROOM_BACK); ?>" title="<?= JText::_(COM_SHOWROOM_BACK); ?>" />
</a>
</div>
<form name="showroom_search" id="showroom_search" method="post" action="index.php?option=com_showroom&view=search<?= $this->querystring ?>">
<input type="text" name="showroom_keyword" id="showroom_keyword" placeholder="<?= JText::_(COM_SHOWROOM_SEARCH); ?>..." />
</form>
<?php if ($this->sess['sr_ver'] >= 32 && $this->sess['sr_template'] == 'blankframe') : ?>
<div class="showroom_multi">
<input type="checkbox" name="multi" id="multi" <?= ($this->sess['sr_multi'] == 'true' ? 'checked="checked"' : '') ?> />
<label for="multi"><span></span>&nbsp;<?= JText::_(COM_SHOWROOM_MULTI_DOWNLOAD); ?></label>
</div>
<?php endif; ?>
</div>
<div class="showroom_clear"></div>
<div class="family_menu">
<h4><?= $this->families[0]->manufacture ?></h4>
<ul>
<?php foreach ($this->families as $family) : ?>
<li>
<?php if ($family->c_id == $this->sess['sr_family']) : ?>
<span class="active"><?= $family->family ?> (<?= $family->darab ?>)</span>
<?php else : ?>
<a href="index.php?option=com_showroom&view=family&family=<?= $family->c_id ?>&product=none<?= $this->querystring ?>">
<?= $family->family_short ?> (<?= $family->darab ?>)
</a>
<?php endif; ?>
</li>
<? endforeach; ?>
</ul>
</div>
<div class="product_container">
<div class="product_image_<?= (isset($this->sess['sr_template']) ? 'narrow' : 'full') ?>">
<img src="<?= $this->product->img ?>" id="img_<?= $this->product->id ?>" alt="<?= $this->product->title ?>" title="<?= $this->product->title ?>" border="0" />
</div>
<div class="product_description <?= (isset($this->sess['sr_template']) ? 'narrow' : 'full') ?>">
<h5><?= $this->product->c_name ?></h5>
<h6><?= $this->product->title ?></h6>
<div style="width:420px;height:245px;overflow:auto;">
<p>
<?php
if (strpos($this->product->desc, "#") !== FALSE) {
$miket = array('#kep_moshato#', '#kep_nem_moshato2#', '#kep_nem_moshato#', '#kep_moshato2#');
$mikre = array(
'<img src="/public/img/collection/kep_moshato.png" />',
'<img src="/public/img/collection/kep_nem_moshato.png" />',
'<img src="/public/img/collection/kep_nem_moshato_alap.png" />',
'<img src="/public/img/collection/kep_moshato2.png" />'
);
$this->product->desc = str_replace($miket, $mikre, $this->product->desc);
}
echo nl2br($this->product->desc);
?></p>
</div>
<p><i><?= JText::_(COM_SHOWROOM_DOWNLOADS); ?>: <strong><?= $this->product->down ?></strong> <?= JText::_(COM_SHOWROOM_VIEWS); ?>: <strong><?= $this->product->show ?></strong></i></p>
<?php
//$letoltlink=(isset($this->sess['sr_template']) ? $this->getDownloadLink($this->product) : '');
$letoltlink = $this->getDownloadLink($this->product);
if ($letoltlink > "") : ?>
<?php
$letoltlink = (isset($this->sess['sr_template']) ? 'http://www.archline.hu/' . $letoltlink : $letoltlink);
?>
<?php if (count($this->files[$this->product->id]) > 1 && $this->sess['sr_ver'] >= 33) : ?>
<div id="downloadButton" class="product_download"><?= JText::_(COM_SHOWROOM_DOWNLOAD); ?></div>
<div id="downloadPanelContainer" style="display:none;">
<table border="0" cellspacing="1" cellpadding="1">
<?php foreach ($this->files[$this->product->id] as $file) : ?>
<?php if ($file->extension != 'unknown') : ?>
<tr>
<td><img src="<?= $file->icon ?>" border="0" /></td>
<td align="left"><a href="<?= $file->multidownloadlink ?>" class="letoltlink" rel="<?= $this->product->id ?>"><?= JText::_("COM_SHOWROOM_" . $file->extension); ?></a></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
<?php else : ?>
<a href="<?= $letoltlink ?>" class="letoltlink" rel="<?= $this->product->id ?>">
<div class="product_download"><?= JText::_(COM_SHOWROOM_DOWNLOAD); ?></div>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="showroom_clear"></div>
<div class="product_scroller" style="padding-top:6px;">
<div class="showroom_container">
<div class="showroom_title showroom_title_level1"><span class="showroom_title_description" style="padding-left:5px;"><?= $this->product->c_name_short ?> (<?= count($this->products) ?>)</span></div>
<div id="makeMeScrollable_1" class="makeMeScrollable">
<?php foreach ($this->products as $product) : ?>
<div id="product_<?= $product->id ?>" class="contentBox <?= ($this->sess['sr_product'] == $product->id ? "active" : "inactive") ?>">
<div class="image">
<?php
$backlink = (isset($_GET['from']) && trim(strtolower($_GET['from'])) == 'search' ? '&from=search' : '');
?>
<a href="/index.php?option=com_showroom&view=product&product=<?= $product->id ?><?= $backlink ?><?= $this->querystring ?>">
<img src="<?= $product->img ?>" alt="<?= $product->title ?>" title="<?= $product->title ?>" />
<div class="description<?= ($this->sess['sr_product'] == $product->id ? "_active" : "") ?>"><span class="description_description"><?= $product->title_short ?></span></div>
</a>
<?php
$letoltlink = (isset($this->sess['sr_template']) ? $this->getDownloadLink($product) : '');
if ($letoltlink > "") : ?>
<?php if (count($this->files[$product->id]) > 1 && $this->sess['sr_ver'] >= 33) : ?>
<div id="smallDownloadPanelContainer-<?= $product->id ?>" class="smallDownloadPanelContainer" style="display:none;">
<table border="0" cellspacing="1" cellpadding="1">
<?php foreach ($this->files[$product->id] as $file) : ?>
<?php if ($file->extension != 'unknown') : ?>
<tr>
<td><img src="<?= $file->icon ?>" border="0" /></td>
<td align="left"><a href="<?= $file->multidownloadlink ?>" class="letoltlink" rel="<?= $this->product->id ?>"><?= JText::_("COM_SHOWROOM_" . $file->extension); ?></a></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
<span class="description_download dd_pos1">
<img src="/components/com_showroom/assets/images/icon-download.png" alt="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" title="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" onclick="javascript:clickSmallButton(<?= $product->id ?>);" />
</span>
<?php else : ?>
<span class="description_download dd_pos1">
<a href="<?= $letoltlink ?>" class="letoltlink" rel="<?= $product->id ?>">
<img src="/components/com_showroom/assets/images/icon-download.png" alt="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" title="<?= JText::_(COM_SHOWROOM_DOWNLOAD); ?>" />
</a>
</span>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<? endforeach; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if (!isset($this->sess['sr_template'])) : ?>
<div class="container">
<div class="row">&nbsp;</div>
</div>
<?php endif; ?>
<?php if (isset($this->sess['sr_template'])) : ?>
<div id="result"></div>
<script type="text/javascript">
jQuery('.letoltlink').click(function() {
jQuery.ajax({
type: "GET",
url: '/components/com_showroom/assets/ajax/AjaxDownloadController.class.php',
data: 'o_id=' + jQuery(this).attr('rel'),
success: function(html) {
jQuery('#result').html(html);
}
});
});
</script>
<?php endif; ?>
<script type="text/javascript">
jQuery(document).ready(function() {
function() {
jQuery("#makeMeScrollable_1").smoothDivScroll({
mousewheelScrolling: "allDirections",
manualContinuousScrolling: true,
autoScrollingMode: "onStart"
});
};
});
jQuery('#multi').click(function() {
jQuery(location).attr('href', '<?= (strpos(JFactory::getURI()->toString(), 'multi=') > 0 ? substr(JFactory::getURI()->toString(), 0, strpos(JFactory::getURI()->toString(), 'multi=') - 1) : JFactory::getURI()->toString()) ?>&multi=' + (jQuery('#multi').is(':checked') ? 'true' : 'false'));
});
jQuery("#downloadButton").click(function() {
jQuery(".smallDownloadPanelContainer").hide(200);
jQuery("#downloadPanelContainer").toggle(200);
});
function clickSmallButton(id) {
var isVisible = jQuery("#smallDownloadPanelContainer-" + id).is(":visible");
jQuery("#downloadPanelContainer").hide(200);
jQuery(".smallDownloadPanelContainer").hide(200);
if (isVisible == false) jQuery("#smallDownloadPanelContainer-" + id).show(200);
}
</script>

View File

@ -1,147 +1,147 @@
<?php
defined('_JEXEC') or die; // No direct access to this file
require_once ( JPATH_BASE.'/includes/defines.php' );
require_once ( JPATH_BASE.'/includes/framework.php' );
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.session.session');
class ShowroomViewProduct extends JViewLegacy
{
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
public $sess=array();
public $url=array();
public function display($tpl = null)
{
$app=JFactory::getApplication();
$session=JFactory::getSession();
$document=JFactory::getDocument();
$model=$this->getModel();
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
$document->addStyleSheet('/components/com_showroom/assets/css/smoothTouchScroll.css');
$document->addStyleSheet('/components/com_showroom/assets/css/showroom.css');
$document->addScript('/components/com_showroom/assets/js/jquery-ui-1.11.2.custom.min.js');
$document->addScript('/components/com_showroom/assets/js/jquery.kinetic-2.0.4.min.js');
$document->addScript('/components/com_showroom/assets/js/jquery.smoothDivScroll-1.3.min.js');
$this->url=$model->getURL($_SERVER['REQUEST_URI']);
// SEF URL
$this->url=$model->getURL($_SERVER['REQUEST_URI']);
if (!isset($_GET['product']) && $this->url['id']>0) $_GET['product']=$this->url['id'];
if (!isset($_GET['lang']) && $this->url['lang']>'') $_GET['lang']=$this->url['lang'];
if (isset($_GET['lang'])) $session->set('sr_lang',(array_key_exists(trim($_GET['lang']),$this->acceptLang) ? trim($_GET['lang']) : $this->defLang));
if (isset($_GET['product']))
{
$product=(trim(addslashes($_GET['product']))=='none' ? '' : (int)$_GET['product']);
$tomb=$session->get('sr_show');
if (!is_array($tomb) || !in_array($product,$tomb))
{
$tomb[]=$product;
$session->set('sr_show',$tomb);
$model->addShow($product);
}
$session->set('sr_product',$product);
}
if (isset($_GET['family'])) $session->set('sr_family',(trim(addslashes($_GET['family']))=='none' ? '' : trim(addslashes($_GET['family']))));
if (isset($_GET['template']) && trim(addslashes($_GET['template']))=='blankframe') $session->set('sr_template','blankframe');
if (isset($_GET['ver'])) $session->set('sr_ver',(int)$_GET['ver']);
if (isset($_GET['multi'])) $session->set('sr_multi', ($_GET['multi']=='true' ? 'true' : 'false'));
if (!$session->get('sr_lang')) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$session->set('sr_family',$model->getFamilyID($session->get('sr_product')));
$this->getSession();
$this->article=$model->getArticle();
$this->families=$model->getFamilies($this->sess['sr_product']);
$this->family=$model->getFamily(((int)$this->sess["sr_family"]>0 ? $this->sess['sr_family'] : 0));
$this->products=$model->getProducts($this->sess['sr_family'],$session->get('sr_lang'));
$this->product=$model->getProduct($this->sess['sr_product'],$session->get('sr_lang'));
$this->querystring=($this->sess['sr_template']>'' ? '&template='.$this->sess['sr_template'] : '').($this->sess['sr_ver']>'' ? '&ver='.$this->sess['sr_ver'] : '').'&lang='.$this->sess['sr_lang'];
$this->productThumb=$model->getProductThumb();
foreach ($this->products as $product) { $this->files[$product->id]=$model->getFiles($product->id); }
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option=com_showroom&view=showroom&type=none&manufacture=none&family=none'.$this->querystring);
if ((int)$this->families[0]->m_id>0) $app->getPathway()->addItem($this->families[0]->manufacture, '/index.php?option=com_showroom&view=showroom&family=none'.($this->sess["sr_type"]>'' ? '&type='.$this->sess["sr_type"] : '').((int)$this->family->m_id>0 ? '&manufacture='.(int)$this->family->m_id : '').$this->querystring);
if ((int)$this->family->m_id>0) $app->getPathway()->addItem($this->family->name, '/index.php?option=com_showroom&view=family&family='.(int)$this->family->c_id.($this->sess["sr_type"]>'' ? '&type='.$this->sess["sr_type"] : '').((int)$this->family->m_id>0 ? '&manufacture='.(int)$this->family->m_id : '').$this->querystring);
if ((int)$this->product->id>0) $app->getPathway()->addItem($this->product->title);
$document->setTitle($this->product->title.' | '.$this->product->c_name.' | '.$this->product->m_name.' | '.JText::_(COM_SHOWROOM_SHOWROOM).' | ARCHLine.XP');
$document->setDescription(substr(strip_tags(str_replace(array("\n","\r"), " ", ($this->product->desc))), 0, 160) );
/*
$document->addCustomTag('<meta property="og:title" content="'.$this->escape($this->product->title).'"/>
<meta property="og:url" content="'.JFactory::getURI()->toString().'"/>
<meta property="og:image" content="'.trim(JURI::base(),'/').'/'.trim($this->product->img,'/').'"/>
<meta property="og:site_name" content="'.JURI::base().'"/>
<meta property="og:description" content="'.$this->escape(substr(strip_tags(str_replace(array("\n","\r"), " ", ($this->product->desc))),0,160) ).'"/>');
*/
if (isset($_GET['desc'])) { print($this->product->desc); die(); }
parent::display($tpl);
}
public function getDownloadLink($obj)
{
$ret="";
$model=$this->getModel();
$fajlok=@scandir($model->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=(trim($obj->file)>'' ? $obj->file : $fajlok[2]); }
else { $f=$fajlok[2]; }
if ($f>"")
{
$ret=$model->getProductDir()."/".$obj->dir."/".$obj->id."/".$f."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($model->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
($this->sess['sr_ver']>=32 ? '&multi='.($this->sess['sr_multi']>'' ? $this->sess['sr_multi'] : 'false') : '');
if ((int)$this->sess['sr_ver']>=33)
{
$struct=$model->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getSession()
{
$this->sess['sr_template']=JFactory::getSession()->get('sr_template');
$this->sess['sr_type']=JFactory::getSession()->get('sr_type');
$this->sess['sr_manufacture']=JFactory::getSession()->get('sr_manufacture');
$this->sess['sr_family']=JFactory::getSession()->get('sr_family');
$this->sess['sr_product']=JFactory::getSession()->get('sr_product');
$this->sess['sr_search']=JFactory::getSession()->get('sr_search');
$this->sess['sr_page']=JFactory::getSession()->get('sr_page');
$this->sess['sr_filter_type']=JFactory::getSession()->get('sr_filter_type');
$this->sess['sr_filter']=JFactory::getSession()->get('sr_filter');
$this->sess['sr_lang']=JFactory::getSession()->get('sr_lang');
$this->sess['sr_ver']=JFactory::getSession()->get('sr_ver');
$this->sess['sr_multi']=JFactory::getSession()->get('sr_multi');
$this->sess['sr_multiselect']=JFactory::getSession()->get('sr_multiselect');
$this->sess['sr_show']=JFactory::getSession()->get('sr_show');
$this->sess['sr_down']=JFactory::getSession()->get('sr_down');
}
}
?>
<?php
defined('_JEXEC') or die; // No direct access to this file
require_once ( JPATH_BASE.'/includes/defines.php' );
require_once ( JPATH_BASE.'/includes/framework.php' );
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.session.session');
class ShowroomViewProduct extends JViewLegacy
{
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
public $sess=array();
public $url=array();
public function display($tpl = null)
{
$app=JFactory::getApplication();
$session=JFactory::getSession();
$document=JFactory::getDocument();
$model=$this->getModel();
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
$document->addStyleSheet('/components/com_showroom/assets/css/smoothTouchScroll.css');
$document->addStyleSheet('/components/com_showroom/assets/css/showroom.css');
$document->addScript('/components/com_showroom/assets/js/jquery-ui-1.11.2.custom.min.js');
$document->addScript('/components/com_showroom/assets/js/jquery.kinetic-2.0.4.min.js');
$document->addScript('/components/com_showroom/assets/js/jquery.smoothDivScroll-1.3.min.js');
$this->url=$model->getURL($_SERVER['REQUEST_URI']);
// SEF URL
$this->url=$model->getURL($_SERVER['REQUEST_URI']);
if (!isset($_GET['product']) && $this->url['id']>0) $_GET['product']=$this->url['id'];
if (!isset($_GET['lang']) && $this->url['lang']>'') $_GET['lang']=$this->url['lang'];
if (isset($_GET['lang'])) $session->set('sr_lang',(array_key_exists(trim($_GET['lang']),$this->acceptLang) ? trim($_GET['lang']) : $this->defLang));
if (isset($_GET['product']))
{
$product=(trim(addslashes($_GET['product']))=='none' ? '' : (int)$_GET['product']);
$tomb=$session->get('sr_show');
if (!is_array($tomb) || !in_array($product,$tomb))
{
$tomb[]=$product;
$session->set('sr_show',$tomb);
$model->addShow($product);
}
$session->set('sr_product',$product);
}
if (isset($_GET['family'])) $session->set('sr_family',(trim(addslashes($_GET['family']))=='none' ? '' : trim(addslashes($_GET['family']))));
if (isset($_GET['template']) && trim(addslashes($_GET['template']))=='blankframe') $session->set('sr_template','blankframe');
if (isset($_GET['ver'])) $session->set('sr_ver',(int)$_GET['ver']);
if (isset($_GET['multi'])) $session->set('sr_multi', ($_GET['multi']=='true' ? 'true' : 'false'));
if (!$session->get('sr_lang')) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$session->set('sr_family',$model->getFamilyID($session->get('sr_product')));
$this->getSession();
$this->article=$model->getArticle();
$this->families=$model->getFamilies($this->sess['sr_product']);
$this->family=$model->getFamily(((int)$this->sess["sr_family"]>0 ? $this->sess['sr_family'] : 0));
$this->products=$model->getProducts($this->sess['sr_family'],$session->get('sr_lang'));
$this->product=$model->getProduct($this->sess['sr_product'],$session->get('sr_lang'));
$this->querystring=($this->sess['sr_template']>'' ? '&template='.$this->sess['sr_template'] : '').($this->sess['sr_ver']>'' ? '&ver='.$this->sess['sr_ver'] : '').'&lang='.$this->sess['sr_lang'];
$this->productThumb=$model->getProductThumb();
foreach ($this->products as $product) { $this->files[$product->id]=$model->getFiles($product->id); }
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option=com_showroom&view=showroom&type=none&manufacture=none&family=none'.$this->querystring);
if ((int)$this->families[0]->m_id>0) $app->getPathway()->addItem($this->families[0]->manufacture, '/index.php?option=com_showroom&view=showroom&family=none'.($this->sess["sr_type"]>'' ? '&type='.$this->sess["sr_type"] : '').((int)$this->family->m_id>0 ? '&manufacture='.(int)$this->family->m_id : '').$this->querystring);
if ((int)$this->family->m_id>0) $app->getPathway()->addItem($this->family->name, '/index.php?option=com_showroom&view=family&family='.(int)$this->family->c_id.($this->sess["sr_type"]>'' ? '&type='.$this->sess["sr_type"] : '').((int)$this->family->m_id>0 ? '&manufacture='.(int)$this->family->m_id : '').$this->querystring);
if ((int)$this->product->id>0) $app->getPathway()->addItem($this->product->title);
$document->setTitle($this->product->title.' | '.$this->product->c_name.' | '.$this->product->m_name.' | '.JText::_(COM_SHOWROOM_SHOWROOM).' | ARCHLine.XP');
$document->setDescription(substr(strip_tags(str_replace(array("\n","\r"), " ", ($this->product->desc))), 0, 160) );
/*
$document->addCustomTag('<meta property="og:title" content="'.$this->escape($this->product->title).'"/>
<meta property="og:url" content="'.JFactory::getURI()->toString().'"/>
<meta property="og:image" content="'.trim(JURI::base(),'/').'/'.trim($this->product->img,'/').'"/>
<meta property="og:site_name" content="'.JURI::base().'"/>
<meta property="og:description" content="'.$this->escape(substr(strip_tags(str_replace(array("\n","\r"), " ", ($this->product->desc))),0,160) ).'"/>');
*/
if (isset($_GET['desc'])) { print($this->product->desc); die(); }
parent::display($tpl);
}
public function getDownloadLink($obj)
{
$ret="";
$model=$this->getModel();
$fajlok=@scandir($model->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=(trim($obj->file)>'' ? $obj->file : $fajlok[2]); }
else { $f=$fajlok[2]; }
if ($f>"")
{
$ret=$model->getProductDir()."/".$obj->dir."/".$obj->id."/".$f."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($model->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
($this->sess['sr_ver']>=32 ? '&multi='.($this->sess['sr_multi']>'' ? $this->sess['sr_multi'] : 'false') : '');
if ((int)$this->sess['sr_ver']>=33)
{
$struct=$model->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getSession()
{
$this->sess['sr_template']=JFactory::getSession()->get('sr_template');
$this->sess['sr_type']=JFactory::getSession()->get('sr_type');
$this->sess['sr_manufacture']=JFactory::getSession()->get('sr_manufacture');
$this->sess['sr_family']=JFactory::getSession()->get('sr_family');
$this->sess['sr_product']=JFactory::getSession()->get('sr_product');
$this->sess['sr_search']=JFactory::getSession()->get('sr_search');
$this->sess['sr_page']=JFactory::getSession()->get('sr_page');
$this->sess['sr_filter_type']=JFactory::getSession()->get('sr_filter_type');
$this->sess['sr_filter']=JFactory::getSession()->get('sr_filter');
$this->sess['sr_lang']=JFactory::getSession()->get('sr_lang');
$this->sess['sr_ver']=JFactory::getSession()->get('sr_ver');
$this->sess['sr_multi']=JFactory::getSession()->get('sr_multi');
$this->sess['sr_multiselect']=JFactory::getSession()->get('sr_multiselect');
$this->sess['sr_show']=JFactory::getSession()->get('sr_show');
$this->sess['sr_down']=JFactory::getSession()->get('sr_down');
}
}
?>

View File

@ -1,124 +1,124 @@
<?php
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.session.session');
class ShowroomViewSearch extends JViewLegacy
{
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
protected $types;
protected $brands;
protected $categories;
protected $subcategories;
public $sess=array();
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$session=&JFactory::getSession();
$model=$this->getModel();
$document=&JFactory::getDocument();
$document->addStyleSheet('/components/'.$app->input->get('option').'/assets/css/showroom.css');
if (isset($_GET['lang'])) $session->set('sr_lang',(array_key_exists(trim($_GET['lang']),$this->acceptLang) ? trim($_GET['lang']) : $this->defLang) );
if (isset($_POST['showroom_keyword']))
{
$multiselect=array('type'=>$_POST['type'],'brand'=>$_POST['brand'],'category'=>$_POST['category'],'subcategory'=>$_POST['subcategory']);
$session->set('sr_search',$_POST['showroom_keyword']);
$session->set('sr_multiselect',$multiselect);
$session->set('sr_page',1);
}
if (isset($_GET['page']) && (int)$_GET['page']>0) $session->set('sr_page',(int)$_GET['page']);
if (isset($_GET['template']) && trim($_GET['template'])=='blankframe') $session->set('sr_template','blankframe');
if (isset($_GET['ver'])) $session->set('sr_ver',(int)$_GET['ver']);
if (isset($_GET['multi'])) $session->set('sr_multi', ($_GET['multi']=='true' ? 'true' : 'false'));
if (!$session->get('sr_lang')) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$this->getSession();
$this->article=$model->getArticle();
$this->products=$model->getResult($this->sess['sr_search'],$this->sess['sr_multiselect'],$this->sess['sr_page']);
$this->all=$model->getAll();
$this->ipp=$model->getIPP();
$this->page=$model->getPage();
$this->last=$model->getLast();
$this->first=$model->getFirst();
$this->pager=$model->getPager();
$this->placeholder=$this->sess['sr_search'];
$this->visibleLast=$model->getVisibleLast();
$this->visibleFirst=$model->getVisibleFirst();
$this->querystring=($this->sess['sr_template']>'' ? '&template='.$this->sess['sr_template'] : '').($this->sess['sr_ver']>'' ? '&ver='.$this->sess['sr_ver'] : '').'&lang='.$this->sess['sr_lang'];
$this->productThumb=$model->getProductThumb();
$this->types=$model->getTypes();
$this->brands=$model->getBrands($this->sess['sr_multiselect']['type']);
$this->categories=$model->getCategories($this->sess['sr_multiselect']['type'],$this->sess['sr_multiselect']['brand']);
$this->subcategories=$model->getSubcategories($this->sess['sr_multiselect']['type'],$this->sess['sr_multiselect']['brand'],$this->sess['sr_multiselect']['category']);
foreach ($this->products as $product) { $this->files[$product->id]=$model->getFiles($product->id); }
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option='.$app->input->get('option').'&view=showroom&type=none&manufacture=none&family=none'.$this->querystring);
$app->getPathway()->addItem( ($this->sess['sr_search']>'' ? ($this->placeholder>'' ? $this->placeholder.": " : "").$this->sess['sr_search'] : JText::_(COM_SHOWROOM_SEARCH)));
parent::display($tpl);
}
public function getDownloadLink($obj)
{
$ret="";
$model=$this->getModel();
$fajlok=@scandir($model->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=(trim($obj->file)>'' ? $obj->file : $fajlok[2]); }
else { $f=$fajlok[2]; }
if ($f>"")
{
$ret=$model->getProductDir()."/".$obj->dir."/".$obj->id."/".$f."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($model->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
($this->sess['sr_ver']>=32 ? '&multi='.($this->sess['sr_multi']>'' ? $this->sess['sr_multi'] : 'false') : '');
if ((int)$this->sess['sr_ver']>=33)
{
$struct=$model->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getSession()
{
$this->sess['sr_template']=JFactory::getSession()->get('sr_template');
$this->sess['sr_type']=JFactory::getSession()->get('sr_type');
$this->sess['sr_manufacture']=JFactory::getSession()->get('sr_manufacture');
$this->sess['sr_family']=JFactory::getSession()->get('sr_family');
$this->sess['sr_product']=JFactory::getSession()->get('sr_product');
$this->sess['sr_search']=JFactory::getSession()->get('sr_search');
$this->sess['sr_page']=JFactory::getSession()->get('sr_page');
$this->sess['sr_filter_type']=JFactory::getSession()->get('sr_filter_type');
$this->sess['sr_filter']=JFactory::getSession()->get('sr_filter');
$this->sess['sr_lang']=JFactory::getSession()->get('sr_lang');
$this->sess['sr_ver']=JFactory::getSession()->get('sr_ver');
$this->sess['sr_multi']=JFactory::getSession()->get('sr_multi');
$this->sess['sr_multiselect']=JFactory::getSession()->get('sr_multiselect');
$this->sess['sr_show']=JFactory::getSession()->get('sr_show');
$this->sess['sr_down']=JFactory::getSession()->get('sr_down');
}
}
<?php
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.session.session');
class ShowroomViewSearch extends JViewLegacy
{
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
protected $types;
protected $brands;
protected $categories;
protected $subcategories;
public $sess=array();
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$session=&JFactory::getSession();
$model=$this->getModel();
$document=&JFactory::getDocument();
$document->addStyleSheet('/components/'.$app->input->get('option').'/assets/css/showroom.css');
if (isset($_GET['lang'])) $session->set('sr_lang',(array_key_exists(trim($_GET['lang']),$this->acceptLang) ? trim($_GET['lang']) : $this->defLang) );
if (isset($_POST['showroom_keyword']))
{
$multiselect=array('type'=>$_POST['type'],'brand'=>$_POST['brand'],'category'=>$_POST['category'],'subcategory'=>$_POST['subcategory']);
$session->set('sr_search',$_POST['showroom_keyword']);
$session->set('sr_multiselect',$multiselect);
$session->set('sr_page',1);
}
if (isset($_GET['page']) && (int)$_GET['page']>0) $session->set('sr_page',(int)$_GET['page']);
if (isset($_GET['template']) && trim($_GET['template'])=='blankframe') $session->set('sr_template','blankframe');
if (isset($_GET['ver'])) $session->set('sr_ver',(int)$_GET['ver']);
if (isset($_GET['multi'])) $session->set('sr_multi', ($_GET['multi']=='true' ? 'true' : 'false'));
if (!$session->get('sr_lang')) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$this->getSession();
$this->article=$model->getArticle();
$this->products=$model->getResult($this->sess['sr_search'],$this->sess['sr_multiselect'],$this->sess['sr_page']);
$this->all=$model->getAll();
$this->ipp=$model->getIPP();
$this->page=$model->getPage();
$this->last=$model->getLast();
$this->first=$model->getFirst();
$this->pager=$model->getPager();
$this->placeholder=$this->sess['sr_search'];
$this->visibleLast=$model->getVisibleLast();
$this->visibleFirst=$model->getVisibleFirst();
$this->querystring=($this->sess['sr_template']>'' ? '&template='.$this->sess['sr_template'] : '').($this->sess['sr_ver']>'' ? '&ver='.$this->sess['sr_ver'] : '').'&lang='.$this->sess['sr_lang'];
$this->productThumb=$model->getProductThumb();
$this->types=$model->getTypes();
$this->brands=$model->getBrands($this->sess['sr_multiselect']['type']);
$this->categories=$model->getCategories($this->sess['sr_multiselect']['type'],$this->sess['sr_multiselect']['brand']);
$this->subcategories=$model->getSubcategories($this->sess['sr_multiselect']['type'],$this->sess['sr_multiselect']['brand'],$this->sess['sr_multiselect']['category']);
foreach ($this->products as $product) { $this->files[$product->id]=$model->getFiles($product->id); }
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option='.$app->input->get('option').'&view=showroom&type=none&manufacture=none&family=none'.$this->querystring);
$app->getPathway()->addItem( ($this->sess['sr_search']>'' ? ($this->placeholder>'' ? $this->placeholder.": " : "").$this->sess['sr_search'] : JText::_(COM_SHOWROOM_SEARCH)));
parent::display($tpl);
}
public function getDownloadLink($obj)
{
$ret="";
$model=$this->getModel();
$fajlok=@scandir($model->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=(trim($obj->file)>'' ? $obj->file : $fajlok[2]); }
else { $f=$fajlok[2]; }
if ($f>"")
{
$ret=$model->getProductDir()."/".$obj->dir."/".$obj->id."/".$f."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($model->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
($this->sess['sr_ver']>=32 ? '&multi='.($this->sess['sr_multi']>'' ? $this->sess['sr_multi'] : 'false') : '');
if ((int)$this->sess['sr_ver']>=33)
{
$struct=$model->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
public function getSession()
{
$this->sess['sr_template']=JFactory::getSession()->get('sr_template');
$this->sess['sr_type']=JFactory::getSession()->get('sr_type');
$this->sess['sr_manufacture']=JFactory::getSession()->get('sr_manufacture');
$this->sess['sr_family']=JFactory::getSession()->get('sr_family');
$this->sess['sr_product']=JFactory::getSession()->get('sr_product');
$this->sess['sr_search']=JFactory::getSession()->get('sr_search');
$this->sess['sr_page']=JFactory::getSession()->get('sr_page');
$this->sess['sr_filter_type']=JFactory::getSession()->get('sr_filter_type');
$this->sess['sr_filter']=JFactory::getSession()->get('sr_filter');
$this->sess['sr_lang']=JFactory::getSession()->get('sr_lang');
$this->sess['sr_ver']=JFactory::getSession()->get('sr_ver');
$this->sess['sr_multi']=JFactory::getSession()->get('sr_multi');
$this->sess['sr_multiselect']=JFactory::getSession()->get('sr_multiselect');
$this->sess['sr_show']=JFactory::getSession()->get('sr_show');
$this->sess['sr_down']=JFactory::getSession()->get('sr_down');
}
}
?>

View File

@ -1,106 +1,106 @@
<?php
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.session.session');
class ShowroomViewSearch2 extends JViewLegacy
{
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
protected $types;
protected $brands;
protected $categories;
protected $subcategories;
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$session=&JFactory::getSession();
$model=$this->getModel();
$document=&JFactory::getDocument();
$document->addStyleSheet('/components/'.$app->input->get('option').'/assets/css/showroom.css');
if (isset($_GET['lang'])) $session->set('sr_lang',(array_key_exists(trim($_GET['lang']),$this->acceptLang) ? trim($_GET['lang']) : $this->defLang) );
if (isset($_POST['showroom_keyword']))
{
$multiselect=array('type'=>$_POST['type'],'brand'=>$_POST['brand'],'category'=>$_POST['category'],'subcategory'=>$_POST['subcategory']);
$session->set('sr_search',$_POST['showroom_keyword']);
$session->set('sr_multiselect',$multiselect);
$session->set('sr_page',1);
}
//print_r($_POST);
//print_r($_SESSION['__default']['sr_multiselect']);
if (isset($_GET['page']) && (int)$_GET['page']>0) $session->set('sr_page',(int)$_GET['page']);
if (isset($_GET['template']) && trim($_GET['template'])=='blankframe') $session->set('sr_template','blankframe');
if (isset($_GET['ver'])) $session->set('sr_ver',(int)$_GET['ver']);
if (isset($_GET['multi'])) $session->set('sr_multi', ($_GET['multi']=='true' ? 'true' : 'false'));
if (!isset($_SESSION['__default']['sr_lang'])) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$this->sess=$_SESSION['__default'];
$this->article=$model->getArticle();
$this->products=$model->getResult($this->sess['sr_search'],$this->sess['sr_multiselect'],$this->sess['sr_page']);
$this->all=$model->getAll();
$this->ipp=$model->getIPP();
$this->page=$model->getPage();
$this->last=$model->getLast();
$this->first=$model->getFirst();
$this->pager=$model->getPager();
$this->placeholder=$session->get('sr_search'); //$model->getPlaceholder();
$this->visibleLast=$model->getVisibleLast();
$this->visibleFirst=$model->getVisibleFirst();
$this->querystring=($session->get('sr_template')>'' ? '&template='.$session->get('sr_template') : '').($session->get('sr_ver')>'' ? '&ver='.$session->get('sr_ver') : '').'&lang='.$session->get('sr_lang');
$this->productThumb=$model->getProductThumb();
$this->types=$model->getTypes();
$this->brands=$model->getBrands($this->sess['sr_multiselect']['type']);
$this->categories=$model->getCategories($this->sess['sr_multiselect']['type'],$this->sess['sr_multiselect']['brand']);
$this->subcategories=$model->getSubcategories($this->sess['sr_multiselect']['type'],$this->sess['sr_multiselect']['brand'],$this->sess['sr_multiselect']['category']);
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option='.$app->input->get('option').'&view=showroom&type=none&manufacture=none&family=none'.$this->querystring);
$app->getPathway()->addItem( ($this->sess['sr_search']>'' ? ($this->placeholder>'' ? $this->placeholder.": " : "").$this->sess['sr_search'] : JText::_(COM_SHOWROOM_SEARCH)));
parent::display($tpl);
}
public function getDownloadLink($obj)
{
$ret="";
$model=$this->getModel();
$fajlok=@scandir($model->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=(trim($obj->file)>'' ? $obj->file : $fajlok[2]); }
else { $f=$fajlok[2]; }
if ($f>"")
{
$ret=$model->getProductDir()."/".$obj->dir."/".$obj->id."/".$f."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($model->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
($_SESSION['__default']['sr_ver']>=32 ? '&multi='.($_SESSION['__default']['sr_multi']>'' ? $_SESSION['__default']['sr_multi'] : 'false') : '');
if ((int)$_SESSION['__default']['sr_ver']>=33)
{
$struct=$model->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
}
<?php
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.session.session');
class ShowroomViewSearch2 extends JViewLegacy
{
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
protected $types;
protected $brands;
protected $categories;
protected $subcategories;
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$session=&JFactory::getSession();
$model=$this->getModel();
$document=&JFactory::getDocument();
$document->addStyleSheet('/components/'.$app->input->get('option').'/assets/css/showroom.css');
if (isset($_GET['lang'])) $session->set('sr_lang',(array_key_exists(trim($_GET['lang']),$this->acceptLang) ? trim($_GET['lang']) : $this->defLang) );
if (isset($_POST['showroom_keyword']))
{
$multiselect=array('type'=>$_POST['type'],'brand'=>$_POST['brand'],'category'=>$_POST['category'],'subcategory'=>$_POST['subcategory']);
$session->set('sr_search',$_POST['showroom_keyword']);
$session->set('sr_multiselect',$multiselect);
$session->set('sr_page',1);
}
//print_r($_POST);
//print_r($_SESSION['__default']['sr_multiselect']);
if (isset($_GET['page']) && (int)$_GET['page']>0) $session->set('sr_page',(int)$_GET['page']);
if (isset($_GET['template']) && trim($_GET['template'])=='blankframe') $session->set('sr_template','blankframe');
if (isset($_GET['ver'])) $session->set('sr_ver',(int)$_GET['ver']);
if (isset($_GET['multi'])) $session->set('sr_multi', ($_GET['multi']=='true' ? 'true' : 'false'));
if (!isset($_SESSION['__default']['sr_lang'])) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$this->sess=$_SESSION['__default'];
$this->article=$model->getArticle();
$this->products=$model->getResult($this->sess['sr_search'],$this->sess['sr_multiselect'],$this->sess['sr_page']);
$this->all=$model->getAll();
$this->ipp=$model->getIPP();
$this->page=$model->getPage();
$this->last=$model->getLast();
$this->first=$model->getFirst();
$this->pager=$model->getPager();
$this->placeholder=$session->get('sr_search'); //$model->getPlaceholder();
$this->visibleLast=$model->getVisibleLast();
$this->visibleFirst=$model->getVisibleFirst();
$this->querystring=($session->get('sr_template')>'' ? '&template='.$session->get('sr_template') : '').($session->get('sr_ver')>'' ? '&ver='.$session->get('sr_ver') : '').'&lang='.$session->get('sr_lang');
$this->productThumb=$model->getProductThumb();
$this->types=$model->getTypes();
$this->brands=$model->getBrands($this->sess['sr_multiselect']['type']);
$this->categories=$model->getCategories($this->sess['sr_multiselect']['type'],$this->sess['sr_multiselect']['brand']);
$this->subcategories=$model->getSubcategories($this->sess['sr_multiselect']['type'],$this->sess['sr_multiselect']['brand'],$this->sess['sr_multiselect']['category']);
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option='.$app->input->get('option').'&view=showroom&type=none&manufacture=none&family=none'.$this->querystring);
$app->getPathway()->addItem( ($this->sess['sr_search']>'' ? ($this->placeholder>'' ? $this->placeholder.": " : "").$this->sess['sr_search'] : JText::_(COM_SHOWROOM_SEARCH)));
parent::display($tpl);
}
public function getDownloadLink($obj)
{
$ret="";
$model=$this->getModel();
$fajlok=@scandir($model->getProductDir().'/'.$obj->dir.'/'.$obj->id);
if ($obj->prver=="2013" && $obj->tipus=="object") { $obj->type_download="accessory"; }
if(!isset($fajlok[2])) { $f=""; }
elseif(count($fajlok)>3) { $f=(trim($obj->file)>'' ? $obj->file : $fajlok[2]); }
else { $f=$fajlok[2]; }
if ($f>"")
{
$ret=$model->getProductDir()."/".$obj->dir."/".$obj->id."/".$f."?download=1&type=".$obj->type_download.
"&bigimage=".base64_encode($model->getProductThumb()."/".$obj->dir."/".$obj->id."/zz_big.jpg").
"&brandcategory=".base64_encode($obj->m_name.'\\'.$obj->c_name_eng).
"&objectname=".base64_encode($obj->title).
($_SESSION['__default']['sr_ver']>=32 ? '&multi='.($_SESSION['__default']['sr_multi']>'' ? $_SESSION['__default']['sr_multi'] : 'false') : '');
if ((int)$_SESSION['__default']['sr_ver']>=33)
{
$struct=$model->getStruct($obj->id);
if (trim($struct->category)>"" && trim($struct->subcategory)>"")
{
$ret.="&category=".base64_encode($struct->category)."&subcategory=".base64_encode($struct->subcategory);
}
}
}
return $ret;
}
}
?>

View File

@ -1,255 +1,255 @@
<?php
/*******************************************************************************
Az eredti descriptor file felépítése:
=====================================
$data["file"] = $adatok[0];
$data["eredeti"] = $adatok[1];
$data["vendegkep"] = $adatok[2];
$data["kepalap"] = $adatok[3];
$data["cim"] = $adatok[4];
$data["cimhun"] = $adatok[5] ? $adatok[5] : $adatok[4];
$data["prver"] = ($adatok[6]=="-1") ? "2012" : $adatok[6];
Pl. (valójában sortörés nélkül van):
------------------------------------
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
Logus_90_Arbore_NA_single (smartshapes(3).oli)#
#
2011
Az új descriptor file felépítése:
=====================================
$data["file"]=$adatok[0],
$data["vendegkep"]=$adatok[1],
$data["nev_eng"]=$adatok[2],
$data["nev_hun"]=$adatok[3],
$data["tipus"]=$adatok[4],
$data["kategoria"]=$adatok[5],
$data["alkategoria"]=$adatok[6],
$data["gyarto"]=$adatok[7],
$data["prver"]=($adatok[8]=="-1" ? "2012" : $adatok[8]),
Pl. (valójában sortörés nélkül van):
------------------------------------
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
brown chair#
barna szék#
material#
Wood#
Oak#
Marrakesh#
-1
*******************************************************************************/
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.application.module.helper');
jimport('joomla.session.session');
class ShowroomViewUpload extends JViewLegacy
{
protected $arrAllowedGroups=array(7,8);
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
protected $desc=array();
protected $data=array();
protected $selected_type;
protected $selected_manufacture;
protected $selected_family;
protected $selected_category;
protected $selected_subcategory;
public $pf='ProductsController';
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$session=&JFactory::getSession();
$document=&JFactory::getDocument();
$model=$this->getModel();
if (isset($_GET['lang']))
{
if (array_key_exists(trim($_GET['lang']), $this->acceptLang)) { $session->set('sr_lang',trim($_GET['lang'])); }
else { $session->set('sr_lang',$this->defLang); }
}
if (isset($_GET['file'])) $session->set('sr_file',(trim(addslashes($_GET['file']))=='none' ? '' : trim(addslashes($_GET['file']))));
if (isset($_GET['type'])) $session->set('sr_type',(trim(addslashes($_GET['type']))=='none' ? '' : trim(addslashes($_GET['type']))));
if (isset($_GET['template']) && trim($_GET['template'])=='blankframe') $session->set('sr_template','blankframe');
if (!isset($_SESSION['__default']['sr_lang'])) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$this->sess=$_SESSION['__default'];
$this->types=$this->get('Types');
$this->manufactures=$model->getManufactures($this->sess['sr_type']);
$this->families=$model->getFamilies($this->sess['sr_type'],$this->sess['sr_manufacture']);
$this->family=$model->getFamily(((int)$this->sess["sr_family"]>0 ? $this->sess['sr_family'] : 0));
$this->querystring='&lang='.$session->get('sr_lang')
.($session->get('sr_template')>'' ? '&template='.$session->get('sr_template') : '')
.($session->get('sr_file')>'' ? '&file='.$session->get('sr_file') : '')
.($session->get('sr_type')>'' ? '&type='.$session->get('sr_type') : '');
if ($session->get('sr_file')>"") {
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$descriptor = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$session->get('sr_file');
} else {
$descriptor = '/home/vendeg/'.$session->get('sr_file');
}
if (is_file($descriptor))
{
$this->desc=explode("#",file_get_contents($descriptor));
if (is_array($this->desc) && count($this->desc)) { foreach ($this->desc as $k=>$v) $this->desc[$k]=trim($v); }
if ($this->desc[0]==$this->desc[1]) // regi struktura
{
$this->data=array(
"file"=>$this->desc[0],
"vendegkep"=>$this->desc[2],
"nev_eng"=>$this->desc[4],
"nev_hun"=>($this->desc[5] ? $this->desc[5] : $this->desc[4]),
"tipus"=>$this->sess['sr_type'],
"kategoria"=>"",
"alkategoria"=>"",
"gyarto"=>"",
"prver"=>($this->desc[6]=="-1" ? "2012" : $this->desc[6]),
"ifc"=>false
);
}
else // uj struktura
{
$this->data=array(
"file"=>$this->desc[0],
"vendegkep"=>$this->desc[1],
"nev_eng"=>$this->desc[2],
"nev_hun"=>$this->desc[3],
"tipus"=>$this->desc[4],
"kategoria"=>$this->desc[5],
"alkategoria"=>$this->desc[6],
"gyarto"=>$this->desc[7],
"prver"=>($this->desc[8]=="-1" ? "2012" : $this->desc[8]),
"ifc"=>(substr($this->desc[0],-4)==".ifc"?TRUE:FALSE)
);
}
if ($this->data['gyarto']>"") { $manufacure=$model->getManufactureByName($this->data['gyarto']); }
if ($this->data['kategoria']>"") { $kategoria=$model->getParentByName($this->data['tipus'],$this->data['kategoria']); }
if ($this->data['alkategoria']>"" && $kategoria->id>0) { $alkategoria=$model->getSubcatByName($this->data['tipus'],$kategoria->id,$this->data['alkategoria']); }
$this->selected_type=$this->data['tipus'];
$this->selected_manufacture=((int)$manufacure->id>0 ? (int)$manufacure->id : 0);
$this->selected_family=$this->sess['sr_family'];
$this->selected_category=((int)$kategoria->id>0 ? (int)$kategoria->id : 0);
$this->selected_subcategory=((int)$alkategoria->id>0 ? (int)$alkategoria->id : 0);
// kis kép elhelyezése a végleges helyére
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$this->data['vendegkep'];
} else {
$honnan = '/home/vendeg/'.$this->data['vendegkep'];
}
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/img/collection/'.$this->data['tipus'];
if (!is_dir($hova)) mkdir($hova, 0777);
$hova.='/'.$this->data['vendegkep'];
if (is_file($honnan) && !is_file($hova)) { copy($honnan,$hova); }
if (isset($_POST['save']))
{
$tomb=array(
'm_id'=>(int)$_POST['m_id'],
'c_id'=>(int)$_POST['c_id'],
'struct_id'=>(int)$_POST['subcat'],
'title_hun'=>trim(addslashes($_POST['title_hun'])),
'title_eng'=>trim(addslashes($_POST['title_eng'])),
'desc_hun'=>trim(addslashes($_POST['desc_hun'])),
'desc_eng'=>trim(addslashes($_POST['desc_eng'])),
'tipus'=>$_POST['tipus'],
'fajl'=>$this->data['file'],
'version'=>$this->data['prver'],
'deleted'=>(isset($_POST['deleted']) ? 0 : 1),
);
// $newID=($this->data['ifc']==FALSE ? $model->saveRecord($tomb) : (int)$_POST['joinID']);
$newID=$model->saveRecord($tomb);
if ((int)$newID>0)
{
$man=$model->getManufacture($tomb['m_id']);
// objektum file(ok) elhelyezése a végleges helyére
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$this->data['file'];
} else {
$honnan = '/home/vendeg/'.$this->data['file'];
}
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/collection/'.$man->dir;
if (!is_dir($hova)) mkdir($hova, 0777);
$hova.='/'.$newID;
if (!is_dir($hova)) mkdir($hova, 0777);
$hova.='/'.$this->data['file'];
if (is_file($honnan)) copy($honnan,$hova);
if ($this->data['ifc']==TRUE)
{
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.str_replace(".ifc",".oli",$this->data['file']);
} else {
$honnan = '/home/vendeg/'.str_replace(".ifc",".oli",$this->data['file']);
}
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/collection/'.$man->dir.'/'.$newID.'/'.str_replace(".ifc",".oli",$this->data['file']);
if (is_file($honnan)) copy($honnan,$hova);
}
// feltöltött kép elhelyezése a végleges helyére
if (is_array($_FILES['fileupload']) && !empty($_FILES['fileupload']) && /*$this->data['ifc']==FALSE &&*/ in_array($_FILES['fileupload']['type'],array('image/jpeg','image/jpg')))
{
$origSize=getimagesize($_FILES['fileupload']['tmp_name']);
$hova=$_SERVER['DOCUMENT_ROOT']."/public/img/collection/".$man->dir;
if (!is_dir($hova)) mkdir($hova,0777);
$hova.="/".$newID;
if (!is_dir($hova)) mkdir($hova,0777);
if (!is_dir($hova."/orig")) mkdir($hova."/orig",0777);
$this->make_thumb($_FILES['fileupload']['tmp_name'], $hova.'/zz_big.jpg', (int)round(($origSize[0]/$origSize[1])*400),400);
$this->make_thumb($_FILES['fileupload']['tmp_name'], $hova.'/zz_thumb.jpg', (int)round(($origSize[0]/$origSize[1])*120),120);
$this->make_thumb($_FILES['fileupload']['tmp_name'], $hova.'/zz_small.jpg', (int)round(($origSize[0]/$origSize[1])*66),66);
move_uploaded_file($_FILES['fileupload']['tmp_name'], $hova.'/orig/'.$_FILES['fileupload']['name']);
}
}
}
}
else { print ("descriptor file nem elérhető"); }
}
$this->parents=$model->getParents();
$this->subcat=$model->getSubcat($this->selected_category);
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option=com_showroom&view=showroom');
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_UPLOAD));
parent::display($tpl);
}
protected function make_thumb($src, $dest, $desired_width,$desired_h)
{
$source_image=imagecreatefromjpeg($src);
$width=imagesx($source_image);
$height=imagesy($source_image);
$desired_height=$desired_h;
$virtual_image=imagecreatetruecolor($desired_width, $desired_height);
imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
imagejpeg($virtual_image, $dest);
}
} // end of class
?>
<?php
/*******************************************************************************
Az eredti descriptor file felépítése:
=====================================
$data["file"] = $adatok[0];
$data["eredeti"] = $adatok[1];
$data["vendegkep"] = $adatok[2];
$data["kepalap"] = $adatok[3];
$data["cim"] = $adatok[4];
$data["cimhun"] = $adatok[5] ? $adatok[5] : $adatok[4];
$data["prver"] = ($adatok[6]=="-1") ? "2012" : $adatok[6];
Pl. (valójában sortörés nélkül van):
------------------------------------
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
Logus_90_Arbore_NA_single (smartshapes(3).oli)#
#
2011
Az új descriptor file felépítése:
=====================================
$data["file"]=$adatok[0],
$data["vendegkep"]=$adatok[1],
$data["nev_eng"]=$adatok[2],
$data["nev_hun"]=$adatok[3],
$data["tipus"]=$adatok[4],
$data["kategoria"]=$adatok[5],
$data["alkategoria"]=$adatok[6],
$data["gyarto"]=$adatok[7],
$data["prver"]=($adatok[8]=="-1" ? "2012" : $adatok[8]),
Pl. (valójában sortörés nélkül van):
------------------------------------
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
brown chair#
barna szék#
material#
Wood#
Oak#
Marrakesh#
-1
*******************************************************************************/
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.application.module.helper');
jimport('joomla.session.session');
class ShowroomViewUpload extends JViewLegacy
{
protected $arrAllowedGroups=array(7,8);
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
protected $desc=array();
protected $data=array();
protected $selected_type;
protected $selected_manufacture;
protected $selected_family;
protected $selected_category;
protected $selected_subcategory;
public $pf='ProductsController';
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$session=&JFactory::getSession();
$document=&JFactory::getDocument();
$model=$this->getModel();
if (isset($_GET['lang']))
{
if (array_key_exists(trim($_GET['lang']), $this->acceptLang)) { $session->set('sr_lang',trim($_GET['lang'])); }
else { $session->set('sr_lang',$this->defLang); }
}
if (isset($_GET['file'])) $session->set('sr_file',(trim(addslashes($_GET['file']))=='none' ? '' : trim(addslashes($_GET['file']))));
if (isset($_GET['type'])) $session->set('sr_type',(trim(addslashes($_GET['type']))=='none' ? '' : trim(addslashes($_GET['type']))));
if (isset($_GET['template']) && trim($_GET['template'])=='blankframe') $session->set('sr_template','blankframe');
if (!isset($_SESSION['__default']['sr_lang'])) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$this->sess=$_SESSION['__default'];
$this->types=$this->get('Types');
$this->manufactures=$model->getManufactures($this->sess['sr_type']);
$this->families=$model->getFamilies($this->sess['sr_type'],$this->sess['sr_manufacture']);
$this->family=$model->getFamily(((int)$this->sess["sr_family"]>0 ? $this->sess['sr_family'] : 0));
$this->querystring='&lang='.$session->get('sr_lang')
.($session->get('sr_template')>'' ? '&template='.$session->get('sr_template') : '')
.($session->get('sr_file')>'' ? '&file='.$session->get('sr_file') : '')
.($session->get('sr_type')>'' ? '&type='.$session->get('sr_type') : '');
if ($session->get('sr_file')>"") {
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$descriptor = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$session->get('sr_file');
} else {
$descriptor = '/home/vendeg/'.$session->get('sr_file');
}
if (is_file($descriptor))
{
$this->desc=explode("#",file_get_contents($descriptor));
if (is_array($this->desc) && count($this->desc)) { foreach ($this->desc as $k=>$v) $this->desc[$k]=trim($v); }
if ($this->desc[0]==$this->desc[1]) // regi struktura
{
$this->data=array(
"file"=>$this->desc[0],
"vendegkep"=>$this->desc[2],
"nev_eng"=>$this->desc[4],
"nev_hun"=>($this->desc[5] ? $this->desc[5] : $this->desc[4]),
"tipus"=>$this->sess['sr_type'],
"kategoria"=>"",
"alkategoria"=>"",
"gyarto"=>"",
"prver"=>($this->desc[6]=="-1" ? "2012" : $this->desc[6]),
"ifc"=>false
);
}
else // uj struktura
{
$this->data=array(
"file"=>$this->desc[0],
"vendegkep"=>$this->desc[1],
"nev_eng"=>$this->desc[2],
"nev_hun"=>$this->desc[3],
"tipus"=>$this->desc[4],
"kategoria"=>$this->desc[5],
"alkategoria"=>$this->desc[6],
"gyarto"=>$this->desc[7],
"prver"=>($this->desc[8]=="-1" ? "2012" : $this->desc[8]),
"ifc"=>(substr($this->desc[0],-4)==".ifc"?TRUE:FALSE)
);
}
if ($this->data['gyarto']>"") { $manufacure=$model->getManufactureByName($this->data['gyarto']); }
if ($this->data['kategoria']>"") { $kategoria=$model->getParentByName($this->data['tipus'],$this->data['kategoria']); }
if ($this->data['alkategoria']>"" && $kategoria->id>0) { $alkategoria=$model->getSubcatByName($this->data['tipus'],$kategoria->id,$this->data['alkategoria']); }
$this->selected_type=$this->data['tipus'];
$this->selected_manufacture=((int)$manufacure->id>0 ? (int)$manufacure->id : 0);
$this->selected_family=$this->sess['sr_family'];
$this->selected_category=((int)$kategoria->id>0 ? (int)$kategoria->id : 0);
$this->selected_subcategory=((int)$alkategoria->id>0 ? (int)$alkategoria->id : 0);
// kis kép elhelyezése a végleges helyére
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$this->data['vendegkep'];
} else {
$honnan = '/home/vendeg/'.$this->data['vendegkep'];
}
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/img/collection/'.$this->data['tipus'];
if (!is_dir($hova)) mkdir($hova, 0777);
$hova.='/'.$this->data['vendegkep'];
if (is_file($honnan) && !is_file($hova)) { copy($honnan,$hova); }
if (isset($_POST['save']))
{
$tomb=array(
'm_id'=>(int)$_POST['m_id'],
'c_id'=>(int)$_POST['c_id'],
'struct_id'=>(int)$_POST['subcat'],
'title_hun'=>trim(addslashes($_POST['title_hun'])),
'title_eng'=>trim(addslashes($_POST['title_eng'])),
'desc_hun'=>trim(addslashes($_POST['desc_hun'])),
'desc_eng'=>trim(addslashes($_POST['desc_eng'])),
'tipus'=>$_POST['tipus'],
'fajl'=>$this->data['file'],
'version'=>$this->data['prver'],
'deleted'=>(isset($_POST['deleted']) ? 0 : 1),
);
// $newID=($this->data['ifc']==FALSE ? $model->saveRecord($tomb) : (int)$_POST['joinID']);
$newID=$model->saveRecord($tomb);
if ((int)$newID>0)
{
$man=$model->getManufacture($tomb['m_id']);
// objektum file(ok) elhelyezése a végleges helyére
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$this->data['file'];
} else {
$honnan = '/home/vendeg/'.$this->data['file'];
}
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/collection/'.$man->dir;
if (!is_dir($hova)) mkdir($hova, 0777);
$hova.='/'.$newID;
if (!is_dir($hova)) mkdir($hova, 0777);
$hova.='/'.$this->data['file'];
if (is_file($honnan)) copy($honnan,$hova);
if ($this->data['ifc']==TRUE)
{
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.str_replace(".ifc",".oli",$this->data['file']);
} else {
$honnan = '/home/vendeg/'.str_replace(".ifc",".oli",$this->data['file']);
}
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/collection/'.$man->dir.'/'.$newID.'/'.str_replace(".ifc",".oli",$this->data['file']);
if (is_file($honnan)) copy($honnan,$hova);
}
// feltöltött kép elhelyezése a végleges helyére
if (is_array($_FILES['fileupload']) && !empty($_FILES['fileupload']) && /*$this->data['ifc']==FALSE &&*/ in_array($_FILES['fileupload']['type'],array('image/jpeg','image/jpg')))
{
$origSize=getimagesize($_FILES['fileupload']['tmp_name']);
$hova=$_SERVER['DOCUMENT_ROOT']."/public/img/collection/".$man->dir;
if (!is_dir($hova)) mkdir($hova,0777);
$hova.="/".$newID;
if (!is_dir($hova)) mkdir($hova,0777);
if (!is_dir($hova."/orig")) mkdir($hova."/orig",0777);
$this->make_thumb($_FILES['fileupload']['tmp_name'], $hova.'/zz_big.jpg', (int)round(($origSize[0]/$origSize[1])*400),400);
$this->make_thumb($_FILES['fileupload']['tmp_name'], $hova.'/zz_thumb.jpg', (int)round(($origSize[0]/$origSize[1])*120),120);
$this->make_thumb($_FILES['fileupload']['tmp_name'], $hova.'/zz_small.jpg', (int)round(($origSize[0]/$origSize[1])*66),66);
move_uploaded_file($_FILES['fileupload']['tmp_name'], $hova.'/orig/'.$_FILES['fileupload']['name']);
}
}
}
}
else { print ("descriptor file nem elérhető"); }
}
$this->parents=$model->getParents();
$this->subcat=$model->getSubcat($this->selected_category);
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option=com_showroom&view=showroom');
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_UPLOAD));
parent::display($tpl);
}
protected function make_thumb($src, $dest, $desired_width,$desired_h)
{
$source_image=imagecreatefromjpeg($src);
$width=imagesx($source_image);
$height=imagesy($source_image);
$desired_height=$desired_h;
$virtual_image=imagecreatetruecolor($desired_width, $desired_height);
imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
imagejpeg($virtual_image, $dest);
}
} // end of class
?>

View File

@ -0,0 +1,154 @@
<?php defined('_JEXEC') or die; ?>
<?php if (!isset($this->sess['sr_template'])):?>
<h3 style="margin-bottom:10px;"><?=JText::_(COM_SHOWROOM_SHOWROOM);?></h3>
<?php endif;?>
<?php
$user=JFactory::getUser();
$groups=$user->get('groups');
if ((int)$user->id>0 && is_array($groups)) : ?>
<?php
$admin=FALSE;
foreach ($groups as $k=>$v) { if (in_array($v,$this->arrAllowedGroups)) $admin=TRUE; }
if ($admin==FALSE) { JFactory::getApplication()->redirect("/index.php?option=com_showroom&view=showroom"); die(); }
?>
<div id="j-main-container">
<form name="showroom_upload" id="showroom_upload" method="post" enctype="multipart/form-data" action="index.php?option=com_showroom&view=uploadgroup<?=$this->querystring?>">
<div class="hasab">
<div class="inputholder" style="height:200px;">
<label for="desc_hun"><?=JText::_('COM_SHOWROOM_DESC_HUN')?>:</label><br />
<textarea name="desc_hun" id="desc_hun"><?=(isset($_POST['desc_hun']) ? $_POST['desc_hun'] : '')?></textarea>
</div>
</div>
<div class="hasab">
<div class="inputholder" style="height:200px;">
<label for="desc_eng"><?=JText::_('COM_SHOWROOM_DESC_ENG')?>:</label><br />
<textarea name="desc_eng" id="desc_eng"><?=(isset($_POST['desc_eng']) ? $_POST['desc_eng'] : '')?></textarea>
</div>
</div>
<div class="hasab">
<div class="inputholder">
<label for="tipus"><?=JText::_('COM_SHOWROOM_TYPE')?>:</label>
<select name="tipus" id="tipus" onchange="javascript:changeTipus();">
<option value=""><?=JText::_('COM_SHOWROOM_ALL')?></option>
<option disabled="disabled">-----</option>
<?php foreach ($this->types as $type):?>
<option value="<?=$type->type?>"<?=($type->type==$this->selected_type ? ' selected="selected"' : '')?>><?=$type->name?></option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="m_id"><?=JText::_('COM_SHOWROOM_MANUFACTURE')?>:</label>
<div id="m_id_container" style="display:inline-block;">
<select name="m_id" id="m_id" onchange="javascript:changeGyarto();">
<option value=""><?=JText::_('COM_SHOWROOM_ALL')?></option>
<option disabled="disabled">-----</option>
<?php foreach ($this->manufactures as $manufacture):?>
<option value="<?=$manufacture->id?>"<?=($manufacture->id==$this->selected_manufacture ? ' selected="selected"' : '')?> ><?=$manufacture->name?></option>
<?php endforeach;?>
</select>
</div>
</div>
<div class="inputholder">
<label for="c_id"><?=JText::_('COM_SHOWROOM_FAMILY')?>:</label>
<div id="c_id_container" style="display:inline-block;">
<select name="c_id" id="c_id" onchange="">
<option value=""><?=JText::_('COM_SHOWROOM_ALL')?></option>
<option disabled="disabled">-----</option>
<?php foreach ($this->families as $family):?>
<option value="<?=$family->c_id?>"<?=((int)$family->c_id==(int)$this->selected_family ? ' selected="selected"' : '')?>><?=$family->name?></option>
<?php endforeach;?>
</select>
</div>
</div>
<div class="inputholder">
<label for="parent" class="szeleslabel"><?=JText::_('COM_SHOWROOM_CAT')?>:</label>
<select name="parent" id="parent" onchange="javascript:changeParent();">
<option value=""><?=JText::_('COM_SHOWROOM_ALL')?></option>
<option disabled="disabled">-----</option>
<?php $lastParentType="";?>
<?php foreach ($this->parents as $parent):?>
<?php if ($lastParentType!=$parent->type) { echo '<option disabled="disabled">'.$parent->type.'</option>'; $lastParentType=$parent->type; } ?>
<option value="<?=$parent->id?>"<?=($parent->id==$this->selected_category ? ' selected="selected"' : '')?>>&nbsp;&nbsp;&nbsp;<?=$parent->name?></option>
<?php endforeach;?>
</select>
</div>
<div class="inputholder">
<label for="subcat" class="szeleslabel"><?=JText::_('COM_SHOWROOM_SUBCAT')?>:</label>
<div id="subcat_container" style="display:inline-block;">
<select name="subcat" id="subcat">
<option value=""><?=JText::_('COM_SHOWROOM_ALL')?></option>
<option disabled="disabled">-----</option>
<?php $lastCategoryType="";?>
<?php foreach ($this->subcat as $subcat):?>
<?php if ($lastCategoryType!=$subcat->parent) { echo '<option disabled="disabled">'.$subcat->parent.'</option>'; $lastCategoryType=$subcat->parent; } ?>
<option value="<?=$subcat->id?>"<?=($subcat->id==$this->selected_subcategory ? ' selected="selected"' : '')?>>&nbsp;&nbsp;&nbsp;<?=$subcat->name?></option>
<?php endforeach;?>
</select>
</div>
</div>
<div class="inputholder">
<label for="deleted_y"><?=JText::_('COM_SHOWROOM_ACTIVE')?>:</label>
<fieldset>
<input type="radio" name="deleted" id="deleted_y" value="0" disabled="disabled" /><label for="deleted_y"><?=JText::_('COM_SHOWROOM_YES')?></label>
<input type="radio" name="deleted" id="deleted_n" value="1" checked="checked" /><label for="deleted_n"><?=JText::_('COM_SHOWROOM_NO')?></label>
</fieldset>
</div>
<div class="inputholder">
<input type="submit" name="save" id="save" value="<?=JText::_('COM_SHOWROOM_SAVE')?>" <?=(count($_POST) ? 'disabled="disabled"' : '')?> onclick="javascript:return ellenoriz();" /><br />
<strong><?=(count($_POST) ? JText::_('COM_SHOWROOM_SAVE_SUCCESSFUL') : '')?></strong>
</div>
</div>
<div class="hasab" style="display:inline-block;width:600px;">
<?php foreach ($this->arrKiskep as $kiskep) : ?>
<?php if (is_file($_SERVER['DOCUMENT_ROOT'].$kiskep)) : ?>
<img src="<?=$kiskep?>" style="max-width:60px;max-height:60px;" border="0" />
<?php endif;?>
<?php endforeach;?>
</div>
<div class="clear"></div>
</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function() { changeTipus(); });
function changeTipus() {
jQuery.get('/administrator/components/com_showroom/assets/ajax/AjaxSelectController.class.php?lang=<?=$this->sess['sr_lang']?>&type=manufacture&tipus='+jQuery('#tipus').val()+'&selected=<?=$this->selected_manufacture?>', function( data ) { jQuery("#m_id_container").html( data ); });
changeGyarto();
}
function changeGyarto() {
jQuery.get('/administrator/components/com_showroom/assets/ajax/AjaxSelectController.class.php?lang=<?=$this->sess['sr_lang']?>&type=family&tipus='+jQuery('#tipus').val()+'&gyarto='+jQuery('#m_id').val()+'&selected=<?=$this->selected_family?>', function( data ) { jQuery("#c_id_container").html( data ); });
}
function changeParent() {
jQuery.get('/administrator/components/com_showroom/assets/ajax/AjaxSelectController.class.php?lang=<?=$this->sess['sr_lang']?>&type=parent&id='+jQuery('#parent').val(), function( data ) { jQuery("#subcat_container").html( data ); });
}
function ellenoriz() {
if (jQuery('#tipus').val()=="") {alert('<?=JText::_('COM_SHOWROOM_MISSING_TYPE')?>!'); return false;}
if (jQuery('#m_id').val()=="") {alert('<?=JText::_('COM_SHOWROOM_MISSING_MANUFACTURE')?>!'); return false;}
if (jQuery('#c_id').val()=="") {alert('<?=JText::_('COM_SHOWROOM_MISSING_FAMILY')?>!'); return false;}
if (jQuery('#parent').val()=="") {alert('<?=JText::_('COM_SHOWROOM_MISSING_PARENT')?>!'); return false;}
if (jQuery('#subcat').val()=="") {alert('<?=JText::_('COM_SHOWROOM_MISSING_SUBCAT')?>!'); return false;}
return true;
}
</script>
<?php else : ?>
<?=JModuleHelper::renderModule(JModuleHelper::getModule('login'),array());?>
<? endif; ?>

View File

@ -1,272 +1,272 @@
<?php
/*******************************************************************************
Az eredti descriptor file felépítése:
=====================================
$data["fajl"] = $adatok[0];
$data["eredeti"] = $adatok[1];
$data["vendegkep"] = $adatok[2];
$data["kepalap"] = $adatok[3];
$data["cim"] = $adatok[4];
$data["cimhun"] = $adatok[5] ? $adatok[5] : $adatok[4];
$data["prver"] = ($adatok[6]=="-1") ? "2012" : $adatok[6];
$data["man"] = $adatok[7];
$data["fam"] = $adatok[8];
Az új descriptor file felépítése:
=====================================
$data["file"]=$adatok[0],
$data["vendegkep"]=$adatok[1],
$data["nev_eng"]=$adatok[2],
$data["nev_hun"]=$adatok[3],
$data["tipus"]=$adatok[4],
$data["kategoria"]=$adatok[5],
$data["alkategoria"]=$adatok[6],
$data["gyarto"]=$adatok[7],
$data["termekcsalad"]=>$this->desc[8],
$data["prver"]=($adatok[9]=="-1" ? "2012" : $adatok[8]),
$data["desc_eng"]=>$this->desc[10],
$data["desc_hun"]=>$this->desc[11],
$data["serial"]=>$this->desc[12],
Pl. (valójában sortörés nélkül van):
------------------------------------
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
brown chair#
barna szék#
material#
Wood#
Oak#
Marrakesh#
-1
*******************************************************************************/
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.application.module.helper');
jimport('joomla.session.session');
class ShowroomViewUploadGroup extends JViewLegacy
{
protected $arrAllowedGroups=array(7,8);
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $desc=array();
protected $data=array();
protected $hiba;
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$lang=&JFactory::getLanguage();
$session=&JFactory::getSession();
$document=&JFactory::getDocument();
$model=$this->getModel();
$document->addStyleSheet('/components/com_showroom/assets/css/showroom.css');
$session->set('sr_template','blankframe');
$session->set('sr_lang','eng');
$lang->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$session->set('sr_file',(trim(addslashes($_GET['file']))=='none' ? '' : trim(addslashes($_GET['file']))));
// $this->sess=$_SESSION['__default'];
$this->out=array();
if (trim($session->get('sr_file'))>"" && trim($session->get('sr_file'))!='none')
{
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$grouplist = trim($_SERVER['DOCUMENT_ROOT'].'/webdav/'.$session->get('sr_file'));
} else {
$grouplist = trim('/home/vendeg/'.$session->get('sr_file'));
}
/*if ($_SERVER['REMOTE_ADDR'] == '213.197.95.246') {
if (file_exists($_SERVER['DOCUMENT_ROOT'].'/webdav/3979EAED-035E-4367-B8C2-52277989A480.oli')) {
echo $grouplist;
echo '<br/>';
echo $_SERVER['DOCUMENT_ROOT'].'/webdav/3979EAED-035E-4367-B8C2-52277989A480.oli';
die();
}
}*/
$this->out['grouplist']=$session->get('sr_file');
$this->out['sorok']=array();
if (is_file($grouplist))
{
$lines=file($grouplist);
if (is_array($lines) && count($lines))
{
foreach ($lines as $idx=>$line)
{
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$descriptor = trim($_SERVER['DOCUMENT_ROOT'].'/webdav/'.$line);
} else {
$descriptor = trim('/home/vendeg/'.$line);
}
$this->out['sorok'][$idx]['descriptor']=$line;
if (is_file($descriptor))
{
$this->desc=explode("#",file_get_contents($descriptor));
if (is_array($this->desc) && count($this->desc)) { foreach ($this->desc as $k=>$v) $this->desc[$k]=trim($v); }
$this->data=array(
"file"=>$this->desc[0],
"nagykep"=>$this->desc[1],
"nev_eng"=>$this->desc[2],
"nev_hun"=>$this->desc[3],
"tipus"=>$this->desc[4],
"kategoria"=>$this->desc[5],
"alkategoria"=>$this->desc[6],
"gyarto"=>$this->desc[7],
"termekcsalad"=>$this->desc[8],
"prver"=>($this->desc[9]=="-1" ? "2012" : $this->desc[9]),
"desc_eng"=>$this->desc[10],
"desc_hun"=>$this->desc[11],
"serial"=>(isset($this->desc[12]) ? trim($this->desc[12]) : ""),
);
$this->out['sorok'][$idx]['data']=$this->data;
if ($this->data['tipus']>"") { $this->tipus=$model->getType($this->data['tipus']); }
if ($this->data['gyarto']>"") { $this->manufacture=$model->getManufactureByName($this->data['gyarto']); }
if ($this->data['termekcsalad']>"" && (int)$this->manufacture->id>0) { $this->termekcsalad=$model->getFamilyByName($this->data['termekcsalad'],$this->manufacture->id); }
if ($this->data['kategoria']>"") { $this->kategoria=$model->getParentByName($this->data['tipus'],$this->data['kategoria']); }
if ($this->data['alkategoria']>"" && (int)$this->kategoria->id>0) { $this->alkategoria=$model->getSubcatByName($this->data['tipus'],$this->kategoria->id,$this->data['alkategoria']); }
$tomb=array(
'kategoria'=>(int)$this->kategoria->id,
't_id'=>$this->tipus->type_download,
'm_id'=>(int)$this->manufacture->id,
'c_id'=>(int)$this->termekcsalad->c_id,
'struct_id'=>(int)$this->alkategoria->id,
'title_hun'=>$this->data['nev_hun'],
'title_eng'=>$this->data['nev_eng'],
'desc_hun'=>$this->data['desc_hun'],
'desc_eng'=>$this->data['desc_eng'],
'tipus'=>$this->data['tipus'],
'fajl'=>$this->data['file'],
'version'=>$this->data['prver'],
'deleted'=>($this->data['gyarto']=='User' ? 1 : 0),
'nUserID'=>$model->getUserBySerial($this->data['serial']),
);
$this->out['sorok'][$idx]['tomb']=$tomb;
$newID=$model->saveRecord($tomb);
$this->out['sorok'][$idx]['newID']=$newID;
if ((int)$newID>0)
{
// objektum file elhelyezése a végleges helyére
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$this->data['file'];
} else {
$honnan = '/home/vendeg/'.$this->data['file'];
}
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/collection/'.$this->manufacture->dir;
if (!is_dir($hova))
{
$ret=mkdir($hova, 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."<br />";$this->hiba++;}
}
$hova.='/'.$newID;
if (!is_dir($hova))
{
$ret=mkdir($hova, 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."<br />";$this->hiba++;}
}
$files=scandir($hova);
$filter=array('.','..','.quarantine');
$parts=explode(".", $this->data['file']);
$upload_ext=strtolower(end($parts));
if (is_array($files) and count($files))
{
foreach ($files as $file)
{
if (!in_array($file, $filter))
{
$parts=explode(".", $file);
$exist_ext=strtolower(end($parts));
if ($exist_ext==$upload_ext) { unlink($hova.'/'.$file); }
}
}
}
$hova.='/'.$this->data['file'];
if (is_file($honnan)) copy($honnan,$hova);
if (is_file($honnan)) unlink($honnan);
// képek legyártása
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$this->data['nagykep'];
} else {
$honnan = '/home/vendeg/'.$this->data['nagykep'];
}
if (is_file($honnan))
{
$origSize=getimagesize($honnan);
if ($origSize[0]>=360 || $origSize[1]>=360)
{
$hova=$_SERVER['DOCUMENT_ROOT']."/public/img/collection/".$this->manufacture->dir;
if (!is_dir($hova))
{
$ret=mkdir($hova, 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."<br />";$this->hiba++;}
}
$hova.="/".$newID;
if (!is_dir($hova))
{
$ret=mkdir($hova, 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."<br />";$this->hiba++;}
}
if (!is_dir($hova."/orig"))
{
$ret=mkdir($hova."/orig", 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."/orig<br />";$this->hiba++;}
}
$this->make_thumb($honnan, $hova.'/zz_big.jpg', (int)round(($origSize[0]/$origSize[1])*400),400);
$this->make_thumb($honnan, $hova.'/zz_thumb.jpg', (int)round(($origSize[0]/$origSize[1])*120),120);
$this->make_thumb($honnan, $hova.'/zz_small.jpg', (int)round(($origSize[0]/$origSize[1])*66),66);
if (is_file($honnan)) copy($honnan,$hova."/orig/".$this->data['nagykep']);
if (is_file($honnan)) unlink($honnan);
}
}
}
unlink($descriptor);
}
else { $this->out['sorok'][$idx]['hiba'].="descriptor file '".$descriptor."' nem elérhető<br />";$this->hiba++; }
}
}
unlink($grouplist);
}
else { $this->out['hiba']="File lista '".$grouplist."' nem elérhető";$this->hiba++; }
$this->article=($this->hiba>0 ? $model->getErrorArticle() : $model->getSuccessArticle());
}
parent::display($tpl);
}
protected function make_thumb($src, $dest, $desired_width,$desired_h)
{
$source_image=imagecreatefromjpeg($src);
$width=imagesx($source_image);
$height=imagesy($source_image);
$desired_height=$desired_h;
$virtual_image=imagecreatetruecolor($desired_width, $desired_height);
imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
imagejpeg($virtual_image, $dest);
}
} // end of class
?>
<?php
/*******************************************************************************
Az eredti descriptor file felépítése:
=====================================
$data["fajl"] = $adatok[0];
$data["eredeti"] = $adatok[1];
$data["vendegkep"] = $adatok[2];
$data["kepalap"] = $adatok[3];
$data["cim"] = $adatok[4];
$data["cimhun"] = $adatok[5] ? $adatok[5] : $adatok[4];
$data["prver"] = ($adatok[6]=="-1") ? "2012" : $adatok[6];
$data["man"] = $adatok[7];
$data["fam"] = $adatok[8];
Az új descriptor file felépítése:
=====================================
$data["file"]=$adatok[0],
$data["vendegkep"]=$adatok[1],
$data["nev_eng"]=$adatok[2],
$data["nev_hun"]=$adatok[3],
$data["tipus"]=$adatok[4],
$data["kategoria"]=$adatok[5],
$data["alkategoria"]=$adatok[6],
$data["gyarto"]=$adatok[7],
$data["termekcsalad"]=>$this->desc[8],
$data["prver"]=($adatok[9]=="-1" ? "2012" : $adatok[8]),
$data["desc_eng"]=>$this->desc[10],
$data["desc_hun"]=>$this->desc[11],
$data["serial"]=>$this->desc[12],
Pl. (valójában sortörés nélkül van):
------------------------------------
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
brown chair#
barna szék#
material#
Wood#
Oak#
Marrakesh#
-1
*******************************************************************************/
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.application.module.helper');
jimport('joomla.session.session');
class ShowroomViewUploadGroup extends JViewLegacy
{
protected $arrAllowedGroups=array(7,8);
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $desc=array();
protected $data=array();
protected $hiba;
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$lang=&JFactory::getLanguage();
$session=&JFactory::getSession();
$document=&JFactory::getDocument();
$model=$this->getModel();
$document->addStyleSheet('/components/com_showroom/assets/css/showroom.css');
$session->set('sr_template','blankframe');
$session->set('sr_lang','eng');
$lang->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$session->set('sr_file',(trim(addslashes($_GET['file']))=='none' ? '' : trim(addslashes($_GET['file']))));
// $this->sess=$_SESSION['__default'];
$this->out=array();
if (trim($session->get('sr_file'))>"" && trim($session->get('sr_file'))!='none')
{
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$grouplist = trim($_SERVER['DOCUMENT_ROOT'].'/webdav/'.$session->get('sr_file'));
} else {
$grouplist = trim('/home/vendeg/'.$session->get('sr_file'));
}
/*if ($_SERVER['REMOTE_ADDR'] == '213.197.95.246') {
if (file_exists($_SERVER['DOCUMENT_ROOT'].'/webdav/3979EAED-035E-4367-B8C2-52277989A480.oli')) {
echo $grouplist;
echo '<br/>';
echo $_SERVER['DOCUMENT_ROOT'].'/webdav/3979EAED-035E-4367-B8C2-52277989A480.oli';
die();
}
}*/
$this->out['grouplist']=$session->get('sr_file');
$this->out['sorok']=array();
if (is_file($grouplist))
{
$lines=file($grouplist);
if (is_array($lines) && count($lines))
{
foreach ($lines as $idx=>$line)
{
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$descriptor = trim($_SERVER['DOCUMENT_ROOT'].'/webdav/'.$line);
} else {
$descriptor = trim('/home/vendeg/'.$line);
}
$this->out['sorok'][$idx]['descriptor']=$line;
if (is_file($descriptor))
{
$this->desc=explode("#",file_get_contents($descriptor));
if (is_array($this->desc) && count($this->desc)) { foreach ($this->desc as $k=>$v) $this->desc[$k]=trim($v); }
$this->data=array(
"file"=>$this->desc[0],
"nagykep"=>$this->desc[1],
"nev_eng"=>$this->desc[2],
"nev_hun"=>$this->desc[3],
"tipus"=>$this->desc[4],
"kategoria"=>$this->desc[5],
"alkategoria"=>$this->desc[6],
"gyarto"=>$this->desc[7],
"termekcsalad"=>$this->desc[8],
"prver"=>($this->desc[9]=="-1" ? "2012" : $this->desc[9]),
"desc_eng"=>$this->desc[10],
"desc_hun"=>$this->desc[11],
"serial"=>(isset($this->desc[12]) ? trim($this->desc[12]) : ""),
);
$this->out['sorok'][$idx]['data']=$this->data;
if ($this->data['tipus']>"") { $this->tipus=$model->getType($this->data['tipus']); }
if ($this->data['gyarto']>"") { $this->manufacture=$model->getManufactureByName($this->data['gyarto']); }
if ($this->data['termekcsalad']>"" && (int)$this->manufacture->id>0) { $this->termekcsalad=$model->getFamilyByName($this->data['termekcsalad'],$this->manufacture->id); }
if ($this->data['kategoria']>"") { $this->kategoria=$model->getParentByName($this->data['tipus'],$this->data['kategoria']); }
if ($this->data['alkategoria']>"" && (int)$this->kategoria->id>0) { $this->alkategoria=$model->getSubcatByName($this->data['tipus'],$this->kategoria->id,$this->data['alkategoria']); }
$tomb=array(
'kategoria'=>(int)$this->kategoria->id,
't_id'=>$this->tipus->type_download,
'm_id'=>(int)$this->manufacture->id,
'c_id'=>(int)$this->termekcsalad->c_id,
'struct_id'=>(int)$this->alkategoria->id,
'title_hun'=>$this->data['nev_hun'],
'title_eng'=>$this->data['nev_eng'],
'desc_hun'=>$this->data['desc_hun'],
'desc_eng'=>$this->data['desc_eng'],
'tipus'=>$this->data['tipus'],
'fajl'=>$this->data['file'],
'version'=>$this->data['prver'],
'deleted'=>($this->data['gyarto']=='User' ? 1 : 0),
'nUserID'=>$model->getUserBySerial($this->data['serial']),
);
$this->out['sorok'][$idx]['tomb']=$tomb;
$newID=$model->saveRecord($tomb);
$this->out['sorok'][$idx]['newID']=$newID;
if ((int)$newID>0)
{
// objektum file elhelyezése a végleges helyére
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$this->data['file'];
} else {
$honnan = '/home/vendeg/'.$this->data['file'];
}
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/collection/'.$this->manufacture->dir;
if (!is_dir($hova))
{
$ret=mkdir($hova, 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."<br />";$this->hiba++;}
}
$hova.='/'.$newID;
if (!is_dir($hova))
{
$ret=mkdir($hova, 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."<br />";$this->hiba++;}
}
$files=scandir($hova);
$filter=array('.','..','.quarantine');
$parts=explode(".", $this->data['file']);
$upload_ext=strtolower(end($parts));
if (is_array($files) and count($files))
{
foreach ($files as $file)
{
if (!in_array($file, $filter))
{
$parts=explode(".", $file);
$exist_ext=strtolower(end($parts));
if ($exist_ext==$upload_ext) { unlink($hova.'/'.$file); }
}
}
}
$hova.='/'.$this->data['file'];
if (is_file($honnan)) copy($honnan,$hova);
if (is_file($honnan)) unlink($honnan);
// képek legyártása
if (isset($_GET['ver']) && $_GET['ver'] >= 39) {
$honnan = $_SERVER['DOCUMENT_ROOT'].'/webdav/'.$this->data['nagykep'];
} else {
$honnan = '/home/vendeg/'.$this->data['nagykep'];
}
if (is_file($honnan))
{
$origSize=getimagesize($honnan);
if ($origSize[0]>=360 || $origSize[1]>=360)
{
$hova=$_SERVER['DOCUMENT_ROOT']."/public/img/collection/".$this->manufacture->dir;
if (!is_dir($hova))
{
$ret=mkdir($hova, 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."<br />";$this->hiba++;}
}
$hova.="/".$newID;
if (!is_dir($hova))
{
$ret=mkdir($hova, 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."<br />";$this->hiba++;}
}
if (!is_dir($hova."/orig"))
{
$ret=mkdir($hova."/orig", 0777);
if ($ret==FALSE) {$this->out['sorok'][$idx]['hiba'].="könyvtár létrehozási hiba: ".$hova."/orig<br />";$this->hiba++;}
}
$this->make_thumb($honnan, $hova.'/zz_big.jpg', (int)round(($origSize[0]/$origSize[1])*400),400);
$this->make_thumb($honnan, $hova.'/zz_thumb.jpg', (int)round(($origSize[0]/$origSize[1])*120),120);
$this->make_thumb($honnan, $hova.'/zz_small.jpg', (int)round(($origSize[0]/$origSize[1])*66),66);
if (is_file($honnan)) copy($honnan,$hova."/orig/".$this->data['nagykep']);
if (is_file($honnan)) unlink($honnan);
}
}
}
unlink($descriptor);
}
else { $this->out['sorok'][$idx]['hiba'].="descriptor file '".$descriptor."' nem elérhető<br />";$this->hiba++; }
}
}
unlink($grouplist);
}
else { $this->out['hiba']="File lista '".$grouplist."' nem elérhető";$this->hiba++; }
$this->article=($this->hiba>0 ? $model->getErrorArticle() : $model->getSuccessArticle());
}
parent::display($tpl);
}
protected function make_thumb($src, $dest, $desired_width,$desired_h)
{
$source_image=imagecreatefromjpeg($src);
$width=imagesx($source_image);
$height=imagesy($source_image);
$desired_height=$desired_h;
$virtual_image=imagecreatetruecolor($desired_width, $desired_height);
imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
imagejpeg($virtual_image, $dest);
}
} // end of class
?>

View File

@ -0,0 +1,243 @@
<?php
/*******************************************************************************
Az eredti descriptor file felépítése:
=====================================
$data["fajl"] = $adatok[0];
$data["eredeti"] = $adatok[1];
$data["vendegkep"] = $adatok[2];
$data["kepalap"] = $adatok[3];
$data["cim"] = $adatok[4];
$data["cimhun"] = $adatok[5] ? $adatok[5] : $adatok[4];
$data["prver"] = ($adatok[6]=="-1") ? "2012" : $adatok[6];
$data["man"] = $adatok[7];
$data["fam"] = $adatok[8];
Az új descriptor file felépítése:
=====================================
$data["file"]=$adatok[0],
$data["vendegkep"]=$adatok[1],
$data["nev_eng"]=$adatok[2],
$data["nev_hun"]=$adatok[3],
$data["tipus"]=$adatok[4],
$data["kategoria"]=$adatok[5],
$data["alkategoria"]=$adatok[6],
$data["gyarto"]=$adatok[7],
$data["prver"]=($adatok[8]=="-1" ? "2012" : $adatok[8]),
Pl. (valójában sortörés nélkül van):
------------------------------------
85151612-3251-2A4C-838D-BDAE5C2ED382.oli#
3000585D-7B7A-BF4D-A501-3ACDE09CCA31.bmp#
brown chair#
barna szék#
material#
Wood#
Oak#
Marrakesh#
-1
*******************************************************************************/
defined('_JEXEC') or die; // No direct access to this file
jimport('joomla.application.component.view'); // import Joomla view library
jimport('joomla.application.module.helper');
jimport('joomla.session.session');
class ShowroomViewUploadGroup extends JViewLegacy
{
protected $arrAllowedGroups=array(7,8);
protected $acceptLang=array('eng'=>'en-GB','hun'=>'hu-HU');
protected $defLang='eng';
protected $desc=array();
protected $data=array();
protected $selected_type;
protected $selected_manufacture;
protected $selected_family;
protected $selected_category;
protected $selected_subcategory;
public function display($tpl = null)
{
$app=&JFactory::getApplication();
$session=&JFactory::getSession();
$document=&JFactory::getDocument();
$model=$this->getModel();
$this->arrKiskep=array();
$document->addStyleSheet('/components/com_showroom/assets/css/showroom.css');
if (isset($_GET['lang']))
{
if (array_key_exists(trim($_GET['lang']), $this->acceptLang)) { $session->set('sr_lang',trim($_GET['lang'])); }
else { $session->set('sr_lang',$this->defLang); }
}
if (isset($_GET['file'])) $session->set('sr_file',(trim(addslashes($_GET['file']))=='none' ? '' : trim(addslashes($_GET['file']))));
if (isset($_GET['type'])) $session->set('sr_type',(trim(addslashes($_GET['type']))=='none' ? '' : trim(addslashes($_GET['type']))));
if (isset($_GET['template']) && trim($_GET['template'])=='blankframe') $session->set('sr_template','blankframe');
if (!isset($_SESSION['__default']['sr_lang'])) $session->set('sr_lang',$this->defLang);
JFactory::getLanguage()->load('com_showroom', JPATH_SITE, $this->acceptLang[$session->get('sr_lang')], true);
$this->sess=$_SESSION['__default'];
$this->types=$this->get('Types');
$this->manufactures=$model->getManufactures($this->sess['sr_type']);
$this->families=$model->getFamilies($this->sess['sr_type'],$this->sess['sr_manufacture']);
$this->family=$model->getFamily(((int)$this->sess["sr_family"]>0 ? $this->sess['sr_family'] : 0));
$this->querystring='&lang='.$session->get('sr_lang')
.($session->get('sr_template')>'' ? '&template='.$session->get('sr_template') : '')
.($session->get('sr_file')>'' ? '&file='.$session->get('sr_file') : '')
.($session->get('sr_type')>'' ? '&type='.$session->get('sr_type') : '');
if (trim($session->get('sr_file'))>"")
{
$grouplist=trim('/home/vendeg/'.$session->get('sr_file'));
if (is_file($grouplist))
{
$lines=file($grouplist);
if (is_array($lines) && count($lines))
{
foreach ($lines as $idx=>$line)
{
$descriptor=trim('/home/vendeg/'.$line);
if (is_file($descriptor))
{
$this->desc=explode("#",file_get_contents($descriptor));
if (is_array($this->desc) && count($this->desc)) { foreach ($this->desc as $k=>$v) $this->desc[$k]=trim($v); }
if ($this->desc[0]==$this->desc[1]) // regi struktura
{
$this->data=array(
"file"=>$this->desc[0],
"vendegkep"=>$this->desc[2],
"nev_eng"=>($this->desc[5] ? $this->desc[5] : $this->desc[4]),
"nev_hun"=>($this->desc[5] ? $this->desc[5] : $this->desc[4]),
"tipus"=>$this->sess['sr_type'],
"kategoria"=>"",
"alkategoria"=>"",
"gyarto"=>$this->desc[7],
"termekcsalad"=>$this->desc[8],
"prver"=>($this->desc[6]=="-1" ? "2012" : $this->desc[6]),
);
}
else // uj struktura
{
$this->data=array(
"file"=>$this->desc[0],
"vendegkep"=>$this->desc[1],
"nev_eng"=>$this->desc[2],
"nev_hun"=>$this->desc[3],
"tipus"=>$this->desc[4],
"kategoria"=>$this->desc[5],
"alkategoria"=>$this->desc[6],
"gyarto"=>$this->desc[7],
"termekcsalad"=>((isset($this->desc[9]) && $this->desc[9]>'') ? $this->desc[9] : ''),
"prver"=>($this->desc[8]=="-1" ? "2012" : $this->desc[8]),
);
}
if ($this->data['gyarto']>"") { $manufacture=$model->getManufactureByName($this->data['gyarto']); }
if ($this->data['termekcsalad']>"" && (int)$manufacture->id>0) { $termekcsalad=$model->getFamilyByName($this->data['termekcsalad'],$manufacture->id); }
if ($this->data['kategoria']>"") { $kategoria=$model->getParentByName($this->data['tipus'],$this->data['kategoria']); }
if ($this->data['alkategoria']>"" && (int)$kategoria->id>0) { $alkategoria=$model->getSubcatByName($this->data['tipus'],$kategoria->id,$this->data['alkategoria']); }
$this->selected_type=$this->data['tipus'];
$this->selected_manufacture=((int)$manufacture->id>0 ? (int)$manufacture->id : 0);
$this->selected_family=((int)$termekcsalad->c_id>0 ? (int)$termekcsalad->c_id : 0);
$this->selected_category=((int)$kategoria->id>0 ? (int)$kategoria->id : 0);
$this->selected_subcategory=((int)$alkategoria->id>0 ? (int)$alkategoria->id : 0);
// kis kép elhelyezése a végleges helyére
$honnan='/home/vendeg/'.$this->data['vendegkep'];
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/img/collection/'.$this->data['tipus'];
if (!is_dir($hova)) mkdir($hova);
$hova.='/'.$this->data['vendegkep'];
if (is_file($honnan) && !is_file($hova)) { copy($honnan,$hova); }
$this->arrKiskep[]=substr($hova, strpos($hova, '/public'));
if (isset($_POST['save']))
{
$tomb=array(
'm_id'=>(int)$_POST['m_id'],
'c_id'=>(int)$_POST['c_id'],
'struct_id'=>(int)$_POST['subcat'],
'title_hun'=>trim(addslashes($this->data['nev_hun'])),
'title_eng'=>trim(addslashes($this->data['nev_eng'])),
'desc_hun'=>trim(addslashes($_POST['desc_hun'])),
'desc_eng'=>trim(addslashes($_POST['desc_eng'])),
'tipus'=>$_POST['tipus'],
'fajl'=>$this->data['file'],
'version'=>$this->data['prver'],
'deleted'=>(isset($_POST['deleted']) ? (int)$_POST['deleted'] : 1),
);
$newID=$model->saveRecord($tomb);
if ((int)$newID>0)
{
$man=$model->getManufacture($tomb['m_id']);
// objektum file elhelyezése a végleges helyére
$honnan='/home/vendeg/'.$this->data['file'];
$hova=$_SERVER['DOCUMENT_ROOT'].'/public/collection/'.$man->dir;
if (!is_dir($hova)) mkdir($hova);
$hova.='/'.$newID;
if (!is_dir($hova)) mkdir($hova);
$hova.='/'.$this->data['file'];
if (is_file($honnan) && !is_file($hova)) { copy($honnan,$hova); }
// képek legyártása
$honnan='/home/vendeg/'.$this->data['vendegkep'];
if (is_file($honnan))
{
$origSize=getimagesize($honnan);
if ($origSize[0]>=400 || $origSize[1]>=400)
{
$hova=$_SERVER['DOCUMENT_ROOT']."/public/img/collection/".$man->dir;
if (!is_dir($hova)) mkdir($hova);
$hova.="/".$newID;
if (!is_dir($hova)) mkdir($hova);
if (!is_dir($hova."/orig")) mkdir($hova."/orig");
$this->make_thumb($honnan, $hova.'/zz_big.jpg', (int)round(($origSize[0]/$origSize[1])*400),400);
$this->make_thumb($honnan, $hova.'/zz_thumb.jpg', (int)round(($origSize[0]/$origSize[1])*120),120);
$this->make_thumb($honnan, $hova.'/zz_small.jpg', (int)round(($origSize[0]/$origSize[1])*66),66);
copy($honnan,$hova."/orig/".$this->data['vendegkep']);
}
}
}
}
}
else { print ("descriptor file '".$descriptor."' nem elérhető<br />"); }
}
}
}
else { print ("grouplist file '".$grouplist."' nem elérhető<br />"); }
}
$this->parents=$model->getParents();
$this->subcat=$model->getSubcat($this->selected_category);
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_SHOWROOM), '/index.php?option=com_showroom&view=showroom');
$app->getPathway()->addItem(JText::_(COM_SHOWROOM_MULTIUPLOAD));
parent::display($tpl);
}
protected function make_thumb($src, $dest, $desired_width,$desired_h)
{
$source_image=imagecreatefromjpeg($src);
$width=imagesx($source_image);
$height=imagesy($source_image);
$desired_height=$desired_h;
$virtual_image=imagecreatetruecolor($desired_width, $desired_height);
imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
imagejpeg($virtual_image, $dest);
}
} // end of class
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +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);
<?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

@ -1,28 +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']);
<?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

@ -1,143 +1,143 @@
<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* https://developers.google.com/recaptcha/docs/php
* - Get a reCAPTCHA API Key
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*
* @copyright Copyright (c) 2014, Google Inc.
* @link http://www.google.com/recaptcha
*
* 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.
*/
/**
* A ReCaptchaResponse is returned from checkAnswer().
*/
class ReCaptchaResponse
{
public $success;
public $errorCodes;
}
class ReCaptcha
{
private static $_signupUrl = "https://www.google.com/recaptcha/admin";
private static $_siteVerifyUrl =
"https://www.google.com/recaptcha/api/siteverify?";
private $_secret;
private static $_version = "php_1.0";
/**
* Constructor.
*
* @param string $secret shared secret between site and ReCAPTCHA server.
*/
function ReCaptcha($secret)
{
if ($secret == null || $secret == "") {
die("To use reCAPTCHA you must get an API key from <a href='"
. self::$_signupUrl . "'>" . self::$_signupUrl . "</a>");
}
$this->_secret=$secret;
}
/**
* Encodes the given data into a query string format.
*
* @param array $data array of string elements to be encoded.
*
* @return string - encoded request.
*/
private function _encodeQS($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 GET to a reCAPTCHA server.
*
* @param string $path url path to recaptcha server.
* @param array $data array of parameters to be sent.
*
* @return array response
*/
private function _submitHTTPGet($path, $data)
{
$req = $this->_encodeQS($data);
$response = file_get_contents($path . $req);
return $response;
}
/**
* Calls the reCAPTCHA siteverify API to verify whether the user passes
* CAPTCHA test.
*
* @param string $remoteIp IP address of end user.
* @param string $response response string from recaptcha verification.
*
* @return ReCaptchaResponse
*/
public function verifyResponse($remoteIp, $response)
{
// Discard empty solution submissions
if ($response == null || strlen($response) == 0) {
$recaptchaResponse = new ReCaptchaResponse();
$recaptchaResponse->success = false;
$recaptchaResponse->errorCodes = 'missing-input';
return $recaptchaResponse;
}
$getResponse = $this->_submitHttpGet(
self::$_siteVerifyUrl,
array (
'secret' => $this->_secret,
'remoteip' => $remoteIp,
'v' => self::$_version,
'response' => $response
)
);
$answers = json_decode($getResponse, true);
$recaptchaResponse = new ReCaptchaResponse();
if (trim($answers ['success']) == true) {
$recaptchaResponse->success = true;
} else {
$recaptchaResponse->success = false;
$recaptchaResponse->errorCodes = $answers [error-codes];
}
if ($_SERVER['REMOTE_ADDR'] == '85.66.171.33') {
var_dump($recaptchaResponse);
die();
}
return $recaptchaResponse;
}
}
<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* https://developers.google.com/recaptcha/docs/php
* - Get a reCAPTCHA API Key
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*
* @copyright Copyright (c) 2014, Google Inc.
* @link http://www.google.com/recaptcha
*
* 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.
*/
/**
* A ReCaptchaResponse is returned from checkAnswer().
*/
class ReCaptchaResponse
{
public $success;
public $errorCodes;
}
class ReCaptcha
{
private static $_signupUrl = "https://www.google.com/recaptcha/admin";
private static $_siteVerifyUrl =
"https://www.google.com/recaptcha/api/siteverify?";
private $_secret;
private static $_version = "php_1.0";
/**
* Constructor.
*
* @param string $secret shared secret between site and ReCAPTCHA server.
*/
function ReCaptcha($secret)
{
if ($secret == null || $secret == "") {
die("To use reCAPTCHA you must get an API key from <a href='"
. self::$_signupUrl . "'>" . self::$_signupUrl . "</a>");
}
$this->_secret=$secret;
}
/**
* Encodes the given data into a query string format.
*
* @param array $data array of string elements to be encoded.
*
* @return string - encoded request.
*/
private function _encodeQS($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 GET to a reCAPTCHA server.
*
* @param string $path url path to recaptcha server.
* @param array $data array of parameters to be sent.
*
* @return array response
*/
private function _submitHTTPGet($path, $data)
{
$req = $this->_encodeQS($data);
$response = file_get_contents($path . $req);
return $response;
}
/**
* Calls the reCAPTCHA siteverify API to verify whether the user passes
* CAPTCHA test.
*
* @param string $remoteIp IP address of end user.
* @param string $response response string from recaptcha verification.
*
* @return ReCaptchaResponse
*/
public function verifyResponse($remoteIp, $response)
{
// Discard empty solution submissions
if ($response == null || strlen($response) == 0) {
$recaptchaResponse = new ReCaptchaResponse();
$recaptchaResponse->success = false;
$recaptchaResponse->errorCodes = 'missing-input';
return $recaptchaResponse;
}
$getResponse = $this->_submitHttpGet(
self::$_siteVerifyUrl,
array (
'secret' => $this->_secret,
'remoteip' => $remoteIp,
'v' => self::$_version,
'response' => $response
)
);
$answers = json_decode($getResponse, true);
$recaptchaResponse = new ReCaptchaResponse();
if (trim($answers ['success']) == true) {
$recaptchaResponse->success = true;
} else {
$recaptchaResponse->success = false;
$recaptchaResponse->errorCodes = $answers [error-codes];
}
if ($_SERVER['REMOTE_ADDR'] == '85.66.171.33') {
var_dump($recaptchaResponse);
die();
}
return $recaptchaResponse;
}
}

View File

@ -1,75 +1,75 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
include( JPATH_SITE . '/components/com_users/views/registration/tmpl/default.php');
$config = JComponentHelper::getParams('com_jsn');
$layout_width=$config->get('layout_width','full');
if( $layout_width == 'full' ) $max_width = 'none';
else $max_width = $config->get('layout_maxwidth','500');
$layout=$config->get('layout_form','horizontal');
$lang = JFactory::getLanguage();
$result = $lang->getTag();
?>
<style>
<?php if($result == "hu-HU") :?>
.spacer-container{display: none;}
<?php endif;?>
.star {display: none;}
div.registration{max-width:<?php if ( empty($max_width) ) echo 'none'; else echo $max_width.'px'; ?>;margin:auto;}
div.registration.formfullwidth{max-width:none;}
#profile_tabs{font-weight:bold;}
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > input,
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > .input-prepend input,
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > fieldset.radio,
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > fieldset.checkboxes,
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > textarea{padding-right:45px !important;}
#member-registration .controls > input,#member-registration .controls > textarea,#member-registration .controls > .input-prepend,#member-registration .controls > .input-prepend input{width:100%;box-sizing:border-box;height:auto;}
#member-registration .controls > input[type="file"]{width:auto;}
#member-registration .control-label label{font-weight:bold;}
.jsn_registration_controls{border-top:1px solid #ccc;padding:20px 0 0;margin-top:20px;clear:both;}
</style>
<script>
jQuery(document).ready(function($){
if( $('div.registration').parent().width() < 800 ) {
$('div.registration').addClass('formfullwidth');
}
<?php if ( $layout == 'horizontal' ) : ?>
if( $('div.registration').parent().width() < 500 ) {
$('#member-registration').removeClass('form-horizontal');
}
<?php endif; ?>
<?php if ( $layout == 'vertical' ) : ?>$('#member-registration').removeClass('form-horizontal');<?php endif; ?>
$(window).resize(function(){
if( $('div.registration').parent().width() < 800 ) {
$('div.registration').addClass('formfullwidth');
}
else {
$('div.registration').removeClass('formfullwidth');
}
<?php if ( $layout == 'horizontal' ) : ?>
if( $('div.registration').parent().width() < 500 ) {
$('#member-registration').removeClass('form-horizontal');
}
else {
$('#member-registration').addClass('form-horizontal');
}
<?php endif; ?>
});
$('#member-registration a.btn:not([class*="btn-"])').addClass('btn-danger');
$('#member-registration .control-group > .control-label > label').each(function(){
$(this).closest('.control-group').addClass($(this).attr('id').replace('jform_','').replace('-lbl','-group'));
});
if($('#system-message-container').length) $('#system-message-container').prependTo("#member-registration");
else $("#member-registration").prepend('<div id="system-message-container" />');
});
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
include( JPATH_SITE . '/components/com_users/views/registration/tmpl/default.php');
$config = JComponentHelper::getParams('com_jsn');
$layout_width=$config->get('layout_width','full');
if( $layout_width == 'full' ) $max_width = 'none';
else $max_width = $config->get('layout_maxwidth','500');
$layout=$config->get('layout_form','horizontal');
$lang = JFactory::getLanguage();
$result = $lang->getTag();
?>
<style>
<?php if($result == "hu-HU") :?>
.spacer-container{display: none;}
<?php endif;?>
.star {display: none;}
div.registration{max-width:<?php if ( empty($max_width) ) echo 'none'; else echo $max_width.'px'; ?>;margin:auto;}
div.registration.formfullwidth{max-width:none;}
#profile_tabs{font-weight:bold;}
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > input,
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > .input-prepend input,
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > fieldset.radio,
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > fieldset.checkboxes,
#member-registration.form-horizontal .control-group.privacy + .control-group .controls > textarea{padding-right:45px !important;}
#member-registration .controls > input,#member-registration .controls > textarea,#member-registration .controls > .input-prepend,#member-registration .controls > .input-prepend input{width:100%;box-sizing:border-box;height:auto;}
#member-registration .controls > input[type="file"]{width:auto;}
#member-registration .control-label label{font-weight:bold;}
.jsn_registration_controls{border-top:1px solid #ccc;padding:20px 0 0;margin-top:20px;clear:both;}
</style>
<script>
jQuery(document).ready(function($){
if( $('div.registration').parent().width() < 800 ) {
$('div.registration').addClass('formfullwidth');
}
<?php if ( $layout == 'horizontal' ) : ?>
if( $('div.registration').parent().width() < 500 ) {
$('#member-registration').removeClass('form-horizontal');
}
<?php endif; ?>
<?php if ( $layout == 'vertical' ) : ?>$('#member-registration').removeClass('form-horizontal');<?php endif; ?>
$(window).resize(function(){
if( $('div.registration').parent().width() < 800 ) {
$('div.registration').addClass('formfullwidth');
}
else {
$('div.registration').removeClass('formfullwidth');
}
<?php if ( $layout == 'horizontal' ) : ?>
if( $('div.registration').parent().width() < 500 ) {
$('#member-registration').removeClass('form-horizontal');
}
else {
$('#member-registration').addClass('form-horizontal');
}
<?php endif; ?>
});
$('#member-registration a.btn:not([class*="btn-"])').addClass('btn-danger');
$('#member-registration .control-group > .control-label > label').each(function(){
$(this).closest('.control-group').addClass($(this).attr('id').replace('jform_','').replace('-lbl','-group'));
});
if($('#system-message-container').length) $('#system-message-container').prependTo("#member-registration");
else $("#member-registration").prepend('<div id="system-message-container" />');
});
</script>

View File

@ -1,422 +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
}
<?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
}
?>

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,325 +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>
<?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

@ -1,44 +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';
<?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

@ -1,44 +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';
<?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';

View File

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

View File

@ -1,335 +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;
}
}
}
<?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

View File

@ -1,58 +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; }
#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; }
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,93 +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
}
<?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
}
?>

114
cadline/docroot/sbtrack.php Normal file
View File

@ -0,0 +1,114 @@
<?php
$cURL = isset($_GET['curl']) ? 1 : 0;
define('MT_RELEASE', '1.0');
define('MT_CURL_OK', ($cURL && in_array('curl', get_loaded_extensions())));
define('MT_TIMEOUT', 10);
define('MT_ERR', !empty($_GET['err']));
if (isset($_GET['mtnotrk'])) {
die();
}
if (MT_ERR) {
error_reporting(E_ALL);
ini_set('display_errors', 'On');
}
else {
error_reporting(0);
}
if (basename(__FILE__) == 'mytracking.php') {
die('For your safety: you should really change the name of this file');
}
if (!empty($_GET['test'])) {
die("OK: ".MT_RELEASE);
}
$hop = isset($_GET['hop']) ? $_GET['hop'] : '';
process_content(retrieve_content(calculate_url($hop)));
exit;
function calculate_url($link) {
$returnurl = '';
if ($link == '') {
$returnurl = 'http://trkapi.com/mytrackingok.gif';
} else if ((preg_match("/.+/", $link))) {
$src = array('/m/', '/r/', '/l/');
$rpl = array('', '/', '/');
$link = str_replace($src, $rpl, $link);
$returnurl = 'http://trkapi.com/' . $link; // 2.0 format
}
return $returnurl;
}
function retrieve_content($url) {
$response = '';
$mt_errstr = '';
$agent = 'MyTracking/'.MT_RELEASE;
$refr = ($_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http';
$refr .= '://';
$refr .= $_SERVER['HTTP_HOST'];
$refr .= $_SERVER['REQUEST_URI'];
if ($url != '') {
if (MT_CURL_OK) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_REFERER, $refr);
curl_setopt($ch, CURLOPT_TIMEOUT, MT_TIMEOUT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if (!$response = curl_exec($ch)) {
$mt_errstr = curl_errno($ch).' '.curl_error($ch);
}
curl_close($ch);
}
else {
$parts = parse_url($url);
$scheme = isset($parts['scheme']) ? $parts['scheme'] : 'http';
$host = isset($parts['host']) ? $parts['host'] : 'trkapi.com';
$port = isset($parts['port']) ? $parts['port'] : 80;
$path = isset($parts['path']) ? $parts['path'] : '/';
$query = isset($parts['query']) ? $parts['query'] : '';
if ($fp = fsockopen ($host, $port, $errno, $errstr, MT_TIMEOUT)) {
$agent = 'MyTracking/'.MT_RELEASE;
fputs ($fp, "GET $path?$query HTTP/1.0\r\nHost: $host\r\nUser-Agent: $agent\r\nReferer: $refr\r\n\r\n");
while (!feof($fp)) {
$response .= fgets ($fp,128);
}
fclose ($fp);
}
else {
$response = false;
$mt_errstr = $errno.' '.$errstr;
}
}
}
if ($response === false) {
if (MT_ERR) {
echo $mt_errstr;
}
else {
header("Location: /?mtnotrk=1");
exit;
}
}
else {
return $response;
}
}
function process_content($pagecontent) {
if ($pagecontent != '') {
list($headers, $body) = explode("\r\n\r\n", $pagecontent, 2);
$headerlines = explode("\r\n", $headers);
foreach ($headerlines as $header) {
if (preg_match("/^HTTP|Location:|Vary:|Content-Length:|Content-Type:/i", $header)) {
header($header);
}
}
echo $body;
}
}

View File

@ -1,476 +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>';
<?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>';
?>

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,10 +1,10 @@
.past { background-color:#e6a8a8; opacity: 0.7; }
.present { background-color:#ffffff; border:2px solid #155215; }
.future { background-color:#71bf73; opacity: 0.9; }
.mb25 { margin-bottom:25px; }
.cimke { font-size: 90% !important;font-weight:bold !important; }
#alapplicationsContainer .controlls {margin-top:15px;}
#alapplicationsContainer a, #alapplicationsContainer a:hover {font-weight:bold;}
#alapplicationsContainer .past a, #alapplicationsContainer .future a {color:#003060;}
.past { background-color:#e6a8a8; opacity: 0.7; }
.present { background-color:#ffffff; border:2px solid #155215; }
.future { background-color:#71bf73; opacity: 0.9; }
.mb25 { margin-bottom:25px; }
.cimke { font-size: 90% !important;font-weight:bold !important; }
#alapplicationsContainer .controlls {margin-top:15px;}
#alapplicationsContainer a, #alapplicationsContainer a:hover {font-weight:bold;}
#alapplicationsContainer .past a, #alapplicationsContainer .future a {color:#003060;}
#alapplicationsContainer .past a:hover, #alapplicationsContainer .future a:hover {color:#ffffff;}

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,32 +1,32 @@
<?php
defined('_JEXEC') or die;
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.course.php');
require_once __DIR__ . '/helper.php'; // Include the ALWorkshops functions only once
$doc = JFactory::getDocument();
$doc->addStyleSheet("/modules/mod_al_applications/assets/css/style.css");
$doc->addScript("/modules/mod_al_applications/assets/js/script.js");
$_POST['course_id'] = isset($_POST['course_id']) ? $_POST['course_id'] : 0;
if (isset($_POST) && (int)$_POST['course_id'] > 0) {
$app = JFactory::getApplication();
$input = $app->input;
$course_id = $input->get('course_id', '', 'int');
$application = ModAlapplicationsHelper::getPublishedApplication($course_id);
if ($application) {
ModAlapplicationsHelper::unPublishApplication($course_id);
JFactory::getApplication()->enqueueMessage(JText::_(MOD_ALAPPLICATIONS_UNPUBLISHED) . ": " . $application[0]->title, 'message');
}
}
$applications = ModAlapplicationsHelper::getOtherApplications();
$level = array(
1 => JText::_('MOD_ALAPPLICATIONS_PRELIMINARY'),
2 => JText::_('MOD_ALAPPLICATIONS_INTERMEDIATE'),
3 => JText::_('MOD_ALAPPLICATIONS_TUTOR_EXAM'),
4 => JText::_('MOD_ALAPPLICATIONS_ADVANCED')
);
require JModuleHelper::getLayoutPath('mod_al_applications', $params->get('layout', 'default'));
<?php
defined('_JEXEC') or die;
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.course.php');
require_once __DIR__ . '/helper.php'; // Include the ALWorkshops functions only once
$doc = JFactory::getDocument();
$doc->addStyleSheet("/modules/mod_al_applications/assets/css/style.css");
$doc->addScript("/modules/mod_al_applications/assets/js/script.js");
$_POST['course_id'] = isset($_POST['course_id']) ? $_POST['course_id'] : 0;
if (isset($_POST) && (int)$_POST['course_id'] > 0) {
$app = JFactory::getApplication();
$input = $app->input;
$course_id = $input->get('course_id', '', 'int');
$application = ModAlapplicationsHelper::getPublishedApplication($course_id);
if ($application) {
ModAlapplicationsHelper::unPublishApplication($course_id);
JFactory::getApplication()->enqueueMessage(JText::_(MOD_ALAPPLICATIONS_UNPUBLISHED) . ": " . $application[0]->title, 'message');
}
}
$applications = ModAlapplicationsHelper::getOtherApplications();
$level = array(
1 => JText::_('MOD_ALAPPLICATIONS_PRELIMINARY'),
2 => JText::_('MOD_ALAPPLICATIONS_INTERMEDIATE'),
3 => JText::_('MOD_ALAPPLICATIONS_TUTOR_EXAM'),
4 => JText::_('MOD_ALAPPLICATIONS_ADVANCED')
);
require JModuleHelper::getLayoutPath('mod_al_applications', $params->get('layout', 'default'));

View File

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="site">
<name>MOD_ARCHLINE_APPLICATIONS_MODULE</name>
<creationDate>Nov 2017</creationDate>
<author>Zsolt Fekete</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>https://www.facbook.com/mcleod78</authorUrl>
<copyright>Copyright © 2017 - All rights reserved.</copyright>
<license>GNU General Public License v2.0</license>
<version>0.0.1</version>
<description>MOD_ARCHLINE_APPLICATIONS_MODULE_DESCRIPTION</description>
<files>
<filename module="mod_al_applications">mod_al_applications.php</filename>
<filename>mod_al_applications.xml</filename>
<filename>helper.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>tmpl</folder>
<folder>assets</folder>
</files>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="static">
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_al_applications.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_al_applications.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_applications.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_applications.ini</language>
</languages>
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="site">
<name>MOD_ARCHLINE_APPLICATIONS_MODULE</name>
<creationDate>Nov 2017</creationDate>
<author>Zsolt Fekete</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>https://www.facbook.com/mcleod78</authorUrl>
<copyright>Copyright © 2017 - All rights reserved.</copyright>
<license>GNU General Public License v2.0</license>
<version>0.0.1</version>
<description>MOD_ARCHLINE_APPLICATIONS_MODULE_DESCRIPTION</description>
<files>
<filename module="mod_al_applications">mod_al_applications.php</filename>
<filename>mod_al_applications.xml</filename>
<filename>helper.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>tmpl</folder>
<folder>assets</folder>
</files>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="static">
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_al_applications.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_al_applications.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_applications.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_applications.ini</language>
</languages>
</extension>

View File

@ -1,104 +1,104 @@
<?php
defined('_JEXEC') or die;
jimport('joomla.access.access');
$user = JFactory::getUser();
$groups = JAccess::getGroupsByUser($user->id, false);
?>
<?php if ((int)$user->id == 0) : ?>
<p><?= JText::_('MOD_ALAPPLICATIONS_MUST_LOGIN') ?></p>
<?= JModuleHelper::renderModule(JModuleHelper::getModule('login', 'Felhasználó - Workshop Bejelentkezés')) ?>
<?php else : ?>
<style>
.smaller-text {
font-size: 18px !important;
}
.bigger-text {
font-size: 22px;
margin-top: 10px !important;
}
.app-row {
margin-top: 10px;
}
.cimke {
line-height: 32px !important;
}
.panel-info,
.panel-heading {
color: black !important;
border-color: #ecf0f1 !important;
}
.panel-heading {
background-color: #ecf0f1 !important;
}
</style>
<div id="alCoursesContainer" class="container">
<?php
$offset = 0;
$tanfolyam = ModAlapplicationsHelper::getCourseTable();
foreach ($tanfolyam as $k => $ws) : ?>
<?php if ($ws->level == 3 && !in_array(18, $groups)) continue; ?>
<?php if ($k == 0 || ($k > 0 && $tanfolyam[$k - 1]->level != $tanfolyam[$k]->level)) : ?>
<?php if ($k > 0) : ?>
<!--belso lezaras-->
</div>
</div>
<!--belso lezaras-->
<?php endif; ?>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="bigger-text"><?= $ws->title ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 smaller-text"><strong><?= JText::_('MOD_ALAPPLICATIONS_SIGNED') ?></strong></div>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 smaller-text"><strong><?= JText::_('MOD_ALAPPLICATIONS_CHANGE') ?></strong></div>
</div>
<?php endif; ?>
<div class="row app-row">
<?php $wsapplications = ModAlapplicationsHelper::getWorkshopApplications((int)$user->id, $ws->id); ?>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
<?php if (count($wsapplications)) : ?>
<?php foreach ($wsapplications as $wsapp) : ?>
<?php if ($wsapp->session_date < date('Y-m-d')) $class = "danger";
if ($wsapp->session_date <= date('Y-m-d') && $application->finish_date >= date('Y-m-d')) $class = "info";
if ($wsapp->session_date > date('Y-m-d')) $class = "success"; ?>
<span class="cimke label label-<?= $class ?> smaller-text"><?= $wsapp->session_date ?></span>&nbsp;
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
<?php if (count($wsapplications)) : ?>
<a href="/<?= $ws->path ?>/<?= ($ws->alias2 > '' ? $ws->alias2 : $ws->alias) ?>" class="sppb-btn custom-al <?php if (date('Y-m-d', time() + 86400 * _RESIGN_DAYS_) <= $wsapp->session_date) : ?>active<?php else : ?>disabled<?php endif ?>" target="_self"><?= JText::_('MOD_ALAPPLICATIONS_CHANGE_2') ?></a><br />
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
<!--vegso lezaras-->
</div>
</div>
<!--vegso lezaras-->
</div>
<script type="text/javascript">
function resignation(id) {
jQuery('#course_id').val(id);
jQuery('#alapplicationsForm').submit();
}
</script>
<?php
defined('_JEXEC') or die;
jimport('joomla.access.access');
$user = JFactory::getUser();
$groups = JAccess::getGroupsByUser($user->id, false);
?>
<?php if ((int)$user->id == 0) : ?>
<p><?= JText::_('MOD_ALAPPLICATIONS_MUST_LOGIN') ?></p>
<?= JModuleHelper::renderModule(JModuleHelper::getModule('login', 'Felhasználó - Workshop Bejelentkezés')) ?>
<?php else : ?>
<style>
.smaller-text {
font-size: 18px !important;
}
.bigger-text {
font-size: 22px;
margin-top: 10px !important;
}
.app-row {
margin-top: 10px;
}
.cimke {
line-height: 32px !important;
}
.panel-info,
.panel-heading {
color: black !important;
border-color: #ecf0f1 !important;
}
.panel-heading {
background-color: #ecf0f1 !important;
}
</style>
<div id="alCoursesContainer" class="container">
<?php
$offset = 0;
$tanfolyam = ModAlapplicationsHelper::getCourseTable();
foreach ($tanfolyam as $k => $ws) : ?>
<?php if ($ws->level == 3 && !in_array(18, $groups)) continue; ?>
<?php if ($k == 0 || ($k > 0 && $tanfolyam[$k - 1]->level != $tanfolyam[$k]->level)) : ?>
<?php if ($k > 0) : ?>
<!--belso lezaras-->
</div>
</div>
<!--belso lezaras-->
<?php endif; ?>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="bigger-text"><?= $ws->title ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 smaller-text"><strong><?= JText::_('MOD_ALAPPLICATIONS_SIGNED') ?></strong></div>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 smaller-text"><strong><?= JText::_('MOD_ALAPPLICATIONS_CHANGE') ?></strong></div>
</div>
<?php endif; ?>
<div class="row app-row">
<?php $wsapplications = ModAlapplicationsHelper::getWorkshopApplications((int)$user->id, $ws->id); ?>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
<?php if (count($wsapplications)) : ?>
<?php foreach ($wsapplications as $wsapp) : ?>
<?php if ($wsapp->session_date < date('Y-m-d')) $class = "danger";
if ($wsapp->session_date <= date('Y-m-d') && $application->finish_date >= date('Y-m-d')) $class = "info";
if ($wsapp->session_date > date('Y-m-d')) $class = "success"; ?>
<span class="cimke label label-<?= $class ?> smaller-text"><?= $wsapp->session_date ?></span>&nbsp;
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
<?php if (count($wsapplications)) : ?>
<a href="/<?= $ws->path ?>/<?= ($ws->alias2 > '' ? $ws->alias2 : $ws->alias) ?>" class="sppb-btn custom-al <?php if (date('Y-m-d', time() + 86400 * _RESIGN_DAYS_) <= $wsapp->session_date) : ?>active<?php else : ?>disabled<?php endif ?>" target="_self"><?= JText::_('MOD_ALAPPLICATIONS_CHANGE_2') ?></a><br />
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
<!--vegso lezaras-->
</div>
</div>
<!--vegso lezaras-->
</div>
<script type="text/javascript">
function resignation(id) {
jQuery('#course_id').val(id);
jQuery('#alapplicationsForm').submit();
}
</script>
<?php endif; ?>

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1.0" client="site" method="upgrade">
<name>AL Login</name>
<author>Nagy Máté</author>
<version>1.0.0</version>
<description>Login into ARCHLine</description>
<files>
<filename>mod_al_login.xml</filename>
<filename module="mod_al_login">mod_al_login.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_al_login.ini</language>
<language tag="en-GB">en-GB.mod_al_login.sys.ini</language>
</languages>
<config>
</config>
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1.0" client="site" method="upgrade">
<name>AL Login</name>
<author>Nagy Máté</author>
<version>1.0.0</version>
<description>Login into ARCHLine</description>
<files>
<filename>mod_al_login.xml</filename>
<filename module="mod_al_login">mod_al_login.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_al_login.ini</language>
<language tag="en-GB">en-GB.mod_al_login.sys.ini</language>
</languages>
<config>
</config>
</extension>

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,87 +1,87 @@
<?php
defined('_JEXEC') or die;
jimport('joomla.user.helper');
class ModAlNewsletterHelper
{
public static function insertUser($name, $email, $phone, $cntr, $prof)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('e.*'));
$query->from($db->quoteName('cl_hlusers.u_emails', 'e'));
$query->where($db->quoteName('e.email') . ' = ' . $db->quote($email));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$existingUser = $db->loadObject();
if (!empty($existingUser)) {
if ($existingUser->newsletter == 1)
return true;
$db->getQuery(true);
$query = "UPDATE cl_hlusers.u_emails SET newsletter = 1 WHERE u_emails_id = '{$existingUser->u_emails_id}'";
$db->setQuery($query);
$db->execute();
return true;
}
$old_db = (JFactory::getLanguage()->getTag() == 'hu-HU' ? "clusers" : "clusers_eng");
$ctrID = (JFactory::getLanguage()->getTag() == 'hu-HU' ? 36 : 0);
if ($phone != '') {
$phone = str_replace('-', '', $phone);
$phone = str_replace(' ', '', $phone);
$phone = str_replace('+', '', $phone);
$phone = str_replace('/', '', $phone);
$phone = str_replace('.', '', $phone);
$phone = str_replace(' ', '', $phone);
}
$user = new stdClass();
$user->strName = $name;
$user->strEMail = $email;
$user->nUserType = 0;
$user->nUserStatus = 0;
$user->nUserProf = 0;
$user->old_db = $old_db;
$user->nSchoolID = 0;
$user->nCtrID = $ctrID;
$user->strTel = $phone;
$user->nCtrID = $cntr;
$user->nUserProf = $prof;
JFactory::getDbo()->insertObject('cl_hlusers.users', $user);
$nUserID = $db->insertid();
$history = new stdClass();
$history->nUserID = $nUserID;
$history->nTopicID = (JFactory::getLanguage()->getTag() == 'hu-HU' ? 38 : 150);
$history->dateEvent = date('Y-m-d');
$history->insertDate = date('Y-m-d H:i:s');
$history->strPlace = 'web';
$history->nManagerID = 36;
JFactory::getDbo()->insertObject('cl_hlusers.u_history', $history);
$emails = new stdClass();
$emails->email = $email;
$emails->nUserID = $nUserID;
$emails->default = 1;
$emails->active = 1;
$emails->deleted = 0;
$emails->newsletter = 1;
JFactory::getDbo()->insertObject('cl_hlusers.u_emails', $emails);
return true;
}
}
<?php
defined('_JEXEC') or die;
jimport('joomla.user.helper');
class ModAlNewsletterHelper
{
public static function insertUser($name, $email, $phone, $cntr, $prof)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('e.*'));
$query->from($db->quoteName('cl_hlusers.u_emails', 'e'));
$query->where($db->quoteName('e.email') . ' = ' . $db->quote($email));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$existingUser = $db->loadObject();
if (!empty($existingUser)) {
if ($existingUser->newsletter == 1)
return true;
$db->getQuery(true);
$query = "UPDATE cl_hlusers.u_emails SET newsletter = 1 WHERE u_emails_id = '{$existingUser->u_emails_id}'";
$db->setQuery($query);
$db->execute();
return true;
}
$old_db = (JFactory::getLanguage()->getTag() == 'hu-HU' ? "clusers" : "clusers_eng");
$ctrID = (JFactory::getLanguage()->getTag() == 'hu-HU' ? 36 : 0);
if ($phone != '') {
$phone = str_replace('-', '', $phone);
$phone = str_replace(' ', '', $phone);
$phone = str_replace('+', '', $phone);
$phone = str_replace('/', '', $phone);
$phone = str_replace('.', '', $phone);
$phone = str_replace(' ', '', $phone);
}
$user = new stdClass();
$user->strName = $name;
$user->strEMail = $email;
$user->nUserType = 0;
$user->nUserStatus = 0;
$user->nUserProf = 0;
$user->old_db = $old_db;
$user->nSchoolID = 0;
$user->nCtrID = $ctrID;
$user->strTel = $phone;
$user->nCtrID = $cntr;
$user->nUserProf = $prof;
JFactory::getDbo()->insertObject('cl_hlusers.users', $user);
$nUserID = $db->insertid();
$history = new stdClass();
$history->nUserID = $nUserID;
$history->nTopicID = (JFactory::getLanguage()->getTag() == 'hu-HU' ? 38 : 150);
$history->dateEvent = date('Y-m-d');
$history->insertDate = date('Y-m-d H:i:s');
$history->strPlace = 'web';
$history->nManagerID = 36;
JFactory::getDbo()->insertObject('cl_hlusers.u_history', $history);
$emails = new stdClass();
$emails->email = $email;
$emails->nUserID = $nUserID;
$emails->default = 1;
$emails->active = 1;
$emails->deleted = 0;
$emails->newsletter = 1;
JFactory::getDbo()->insertObject('cl_hlusers.u_emails', $emails);
return true;
}
}

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,10 +1,10 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Jetzt unseren wöchentlichen Newsletter abonnieren!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Werden Sie Mitglied in unserer Community und erhalten Sie die neuesten Tutorials, Angebote und Nachrichten direkt per E-Mail."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="E-mail Adresse"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Abonnieren"
MOD_AL_NEWSLETTER_DONE="Danke für Ihr Abonnement"
MOD_AL_NEWSLETTER_PHONE="Telefonnummer"
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Jetzt unseren wöchentlichen Newsletter abonnieren!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Werden Sie Mitglied in unserer Community und erhalten Sie die neuesten Tutorials, Angebote und Nachrichten direkt per E-Mail."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="E-mail Adresse"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Abonnieren"
MOD_AL_NEWSLETTER_DONE="Danke für Ihr Abonnement"
MOD_AL_NEWSLETTER_PHONE="Telefonnummer"
MOD_AL_NEWSLETTER_PHONE_DESC="Telefonnummer"

View File

@ -1,7 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="GET OUR NEWSLETTER"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Want the latest and greatest from our blog straight to your inbox? Chucks us your details and get a sweet weekly email."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="GET OUR NEWSLETTER"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Want the latest and greatest from our blog straight to your inbox? Chucks us your details and get a sweet weekly email."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"

View File

@ -1,8 +1,8 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Subscribe to our weekly newsletter!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Join our community to get the latest tutorials, offers and news delivered directly in your inbox."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Subscribe to our weekly newsletter!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Join our community to get the latest tutorials, offers and news delivered directly in your inbox."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"
MOD_AL_NEWSLETTER_DONE="Thank you for subscribing"

View File

@ -1,7 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="GET OUR NEWSLETTER"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Want the latest and greatest from our blog straight to your inbox? Chucks us your details and get a sweet weekly email."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="GET OUR NEWSLETTER"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Want the latest and greatest from our blog straight to your inbox? Chucks us your details and get a sweet weekly email."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"

View File

@ -1,10 +1,10 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Iratkozz fel heti hírlevelünkre!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Csatlakozz az ARCHLine.XP közösségéhez, értesülj elsők között oktatóvideóinkról, akcióinkről és híreinkről! "
MOD_AL_NEWSLETTER_NAME="Név"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Név"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Email"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Feliratkozom"
MOD_AL_NEWSLETTER_DONE="Köszönjük, hogy feliratkozott hírlevelünkre"
MOD_AL_NEWSLETTER_PHONE="Telefonszám"
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Iratkozz fel heti hírlevelünkre!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Csatlakozz az ARCHLine.XP közösségéhez, értesülj elsők között oktatóvideóinkról, akcióinkről és híreinkről! "
MOD_AL_NEWSLETTER_NAME="Név"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Név"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Email"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Feliratkozom"
MOD_AL_NEWSLETTER_DONE="Köszönjük, hogy feliratkozott hírlevelünkre"
MOD_AL_NEWSLETTER_PHONE="Telefonszám"
MOD_AL_NEWSLETTER_PHONE_DESC="Telefonszám"

View File

@ -1,7 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Iratkozzon fel hírlevelünkre"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Szeretné a legújabb és legjobb híreket blogunkról egyenesen a postaládájába? Elküldi nekünk az adatait, és kap egy kedves heti e-mailt."
MOD_AL_NEWSLETTER_NAME="Név"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="A neve"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Az email címe"
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Iratkozzon fel hírlevelünkre"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Szeretné a legújabb és legjobb híreket blogunkról egyenesen a postaládájába? Elküldi nekünk az adatait, és kap egy kedves heti e-mailt."
MOD_AL_NEWSLETTER_NAME="Név"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="A neve"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Az email címe"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Feliratkozás"

View File

@ -1,72 +1,72 @@
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . '/helper.php';
if (isset($_POST['action']) && $_POST['action'] == 'subscribe') {
$app = JFactory::getApplication();
if ($_POST['name'] != '' || $_POST['email'] != '') {
$datetime = new \DateTime('');
$date = $datetime->format('c');
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
if (isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) {
$api_url = 'https://www.google.com/recaptcha/api/siteverify';
$resq_data = array(
'secret' => '6Le1o70lAAAAAE125nVz9KQYBX1h2-o5kmlx4tJw',
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
);
$curlConfig = array(
CURLOPT_URL => $api_url,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $resq_data
);
$ch = curl_init();
curl_setopt_array($ch, $curlConfig);
$response = curl_exec($ch);
curl_close($ch);
$responseData = json_decode($response);
if (!$responseData->success) {
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'FAILURE' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
$app->enqueueMessage('Captcha failed', 'error');
}
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'SUCCESS' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
$input = $app->input;
$name = $input->get('name', '', 'string');
$email = $input->get('email', '', 'string');
$phone = $input->get('phone', '', 'string');
$cntr = $input->get('cntr', '', 'int');
$prof = $input->get('prof', '', 'int');
$user = ModAlNewsletterHelper::insertUser($name, $email, $phone, $cntr, $prof);
unset($_POST['subscribe-newsletter-btn']);
unset($_POST['name']);
unset($_POST['email']);
if ($user) {
$app->enqueueMessage(JText::_('MOD_AL_NEWSLETTER_DONE'));
}
} else {
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'FAILURE' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
}
}
}
if ($_GET['Itemid'] != 744 && $_GET['Itemid'] != 745)
require JModuleHelper::getLayoutPath('mod_al_newsletter', $params->get('layout', 'default'));
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . '/helper.php';
if (isset($_POST['action']) && $_POST['action'] == 'subscribe') {
$app = JFactory::getApplication();
if ($_POST['name'] != '' || $_POST['email'] != '') {
$datetime = new \DateTime('');
$date = $datetime->format('c');
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
if (isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) {
$api_url = 'https://www.google.com/recaptcha/api/siteverify';
$resq_data = array(
'secret' => '6Le1o70lAAAAAE125nVz9KQYBX1h2-o5kmlx4tJw',
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
);
$curlConfig = array(
CURLOPT_URL => $api_url,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $resq_data
);
$ch = curl_init();
curl_setopt_array($ch, $curlConfig);
$response = curl_exec($ch);
curl_close($ch);
$responseData = json_decode($response);
if (!$responseData->success) {
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'FAILURE' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
$app->enqueueMessage('Captcha failed', 'error');
}
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'SUCCESS' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
$input = $app->input;
$name = $input->get('name', '', 'string');
$email = $input->get('email', '', 'string');
$phone = $input->get('phone', '', 'string');
$cntr = $input->get('cntr', '', 'int');
$prof = $input->get('prof', '', 'int');
$user = ModAlNewsletterHelper::insertUser($name, $email, $phone, $cntr, $prof);
unset($_POST['subscribe-newsletter-btn']);
unset($_POST['name']);
unset($_POST['email']);
if ($user) {
$app->enqueueMessage(JText::_('MOD_AL_NEWSLETTER_DONE'));
}
} else {
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'FAILURE' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
}
}
}
if ($_GET['Itemid'] != 744 && $_GET['Itemid'] != 745)
require JModuleHelper::getLayoutPath('mod_al_newsletter', $params->get('layout', 'default'));

View File

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="site">
<name>mod_al_newsletter</name>
<creationDate>August 2022</creationDate>
<author>Nagy Máté</author>
<authorEmail>mate.nagy@cadline.hu</authorEmail>
<copyright>Copyright © 2021 - All rights reserved.</copyright>
<version>0.0.1</version>
<description>Create a newsletter subscription popup modal</description>
<files>
<filename module="mod_al_newsletter">mod_al_newsletter.php</filename>
<filename>mod_al_newsletter.xml</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<folder>language</folder>
<folder>tmpl</folder>
</files>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="static">
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_al_newsletter.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_al_newsletter.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_newsletter.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_newsletter.ini</language>
<language tag="de-DE">de-DE/de-DE.mod_al_newsletter.sys.ini</language>
<language tag="de-DE">de-DE/de-DE.mod_al_newsletter.ini</language>
</languages>
</extension>
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="site">
<name>mod_al_newsletter</name>
<creationDate>August 2022</creationDate>
<author>Nagy Máté</author>
<authorEmail>mate.nagy@cadline.hu</authorEmail>
<copyright>Copyright © 2021 - All rights reserved.</copyright>
<version>0.0.1</version>
<description>Create a newsletter subscription popup modal</description>
<files>
<filename module="mod_al_newsletter">mod_al_newsletter.php</filename>
<filename>mod_al_newsletter.xml</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<folder>language</folder>
<folder>tmpl</folder>
</files>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="static">
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_al_newsletter.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_al_newsletter.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_newsletter.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_newsletter.ini</language>
<language tag="de-DE">de-DE/de-DE.mod_al_newsletter.sys.ini</language>
<language tag="de-DE">de-DE/de-DE.mod_al_newsletter.ini</language>
</languages>
</extension>

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -1,12 +1,12 @@
<?php
defined('_JEXEC') or die;
jimport('joomla.user.helper');
class ModAlUploadHelper
{
public static function isImage($img)
{
return (bool)getimagesize($img);
}
}
<?php
defined('_JEXEC') or die;
jimport('joomla.user.helper');
class ModAlUploadHelper
{
public static function isImage($img)
{
return (bool)getimagesize($img);
}
}

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More