| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/ |
Upload File : |
<?
// ----------------------------------------------------------------------------------
// Μεταβλητές που χρησιμοποιούνται στο Layout
// ----------------------------------------------------------------------------------
// Μεταβλητές πληροφορίας ιστοτόπου
// -----------------------------------------
// $general_settings["site_title"]: Ο τίτλος του ιστότοπου όπως υπάρχει στο Control Panel
// $general_settings["site_slogan"]: Σύνθημα ιστοτόπου που εμφανίζεται συνήθως κάτω από τον κυρίως τίτλο στην κορυφή της σελίδας
// $general_settings["meta_description"]: Γενική περιγραφή ιστοτόπου
// $general_settings["meta_keywords"]: Γενικές λέξεις-κλειδιά ιστοτόπου
// $general_settings["site_url"]: H url διεύθυνση του ιστοτόπου
// -----------------------------
// Μεταβλητές επικοινωνίας
// -----------------------------
// $general_settings["owner_name"]
// $general_settings["owner_email"]
// $general_settings["owner_address"]
// $general_settings["owner_city"]
// $general_settings["owner_country"]
// $general_settings["owner_zipcode"]
// $general_settings["owner_tel"]
// $general_settings["owner_fax"]
// $general_settings["owner_cellphone"]
// $general_settings["extra_info"]
// --------------------------------
// Υπολογιζόμενες μεταβλητές
// --------------------------------
// $lang: Ο κωδικός της τρέχουσας γλώσσας
// $locale: Το locale της τρέχουσας γλώσσας
// $head_title: Ο τίτλος που εμφανίζεται στην κορυφή του browser
// $header_data: Μεταβλητή που περιέχει όλα τις πληροφορίες του header των meta tags
// $main_menu: Περιέχει σε HTML όλη τη δομή του κυρίως μενού (ul>li>ul>li κλπ)
// $contents_per_page: Ο αριθμός των άρθρων που πρόκειται να εμφανιστούν στην τρέχουσα σελίδα
// $contents_array["id"][]: Πίνακας με τα ids των άρθρων της τρέχουσας κατηγορίας
// $contents_array["title"][]: Πίνακας με τους τίτλους των άρθρων της τρέχουσας κατηγορίας
// $contents_array["body_preview"][]: Πίνακας με την περίληψη των άρθρων της τρέχουσας κατηγορίας
// $contents_array["body"][]: Πίνακας με το κυρίως περιεχόμενο των άρθρων της τρέχουσας κατηγορίας
// $contents_array["link"][]: Πίνακας με τo link των άρθρων της τρέχουσας κατηγορίας
// $contents_array["metadata"][]: Πίνακας με τις πληροφορίες συντάκτη/ημερομηνίας των άρθρων της τρέχουσας κατηγορίας
// $modules["position"][]: Πίνακας που περιέχει υπό μορφή πινάκων τον HTML κώδικα των modules (όπου position=Header,Left,Right,... κλπ )
// $breadcrumb: Μεταβλητή που περιέχει τον HTML κώδικα για προβολή του breadcrumb
// $pagination: Μεταβλητή που περιέχει τον HTML κώδικα του μενού της σελιδοποίησης για τις κατηγορίες με πολλά άρθρα
// $has_subcats: Η μεταβλητή αυτή είναι true αν η τρέχουσα κατηγορία έχει άλλες υποκατηγορίες
// $main_content: Το πλήρες HTML περιεχόμενο της κάθε σελίδας (τίτλοι, άρθρα, σελιδοποίηση κ.λ.π.)
// $modules['position']: Πίνακας με όλα τα modules μιας δεδομένης θέσης
// $is_searchpage: True αν πρόκειται για σελίδα αποτελεσμάτων αναζήτησης
// $category_settings["id"]: Το id της επιλεγμένης κατηγορίας
// $category_settings["title"]: Ο τίτλος της επιλεγμένης κατηγορίας
// $category_settings["description"]: Η περιγραφή της επιλεγμένης κατηγορίας
// $category_settings["menu_type"]: Ο τύπος της επιλεγμένης κατηγορίας
// $category_settings["picture"]: Το εικονίδιο της επιλεγμένης κατηγορίας
// ----------------------------------------------------------------------------------
session_start();
require_once('includes/DbConnector.php');
require_once('includes/LdapConnector.php');
require_once("includes/UserSession.php");
require_once('includes/SystemComponent.php');
require_once("includes/Categories.php");
require_once('includes/Translator.php');
require_once('includes/Validator.php');
require_once('includes/Search.php');
require_once('includes/Content.php');
require_once('includes/Modules.php');
require_once('includes/Attachments.php');
require_once('includes/Photogalleries.php');
require_once('includes/Contacts.php');
require_once('includes/Newsletter.php');
require_once('includes/Comments.php');
require_once('includes/Tags.php');
$connector = new DbConnector;
$session = new UserSession($connector);
$system = new SystemComponent($connector);
$categories = new Categories($connector);
$translator = new Translator($connector);
$content = new Content($connector, $system, $translator);
$validator = new Validator;
$galleries = new Photogalleries($connector, $system, $translator);
$contacts = new Contacts($connector, $system, $translator);
$modules = new Modules($connector, $system, $translator);
$newsletter = new Newsletter($connector);
$comments = new Comments($connector, $system);
$tags = new Tags($connector);
require_once("includes/RegisterGlobals.php");
$id = (int) $id;
$cat_id = (int) $cat_id;
$gallery_id = (int) $gallery_id;
$start = (int) $start;
$start1 = (int) $start1;
$start2 = (int) $start2;
$weblink = (int) $weblink;
// Καθορίζει με βάση την έγκυρη ή όχι παράμετρο $lang και το αποθηκευμένο $_SESSION["lang_code"] πια θα είναι τελικά η τρέχουσα γλώσσα
$translator->defineCurrentLang($lang, $_SESSION["lang_code"]);
$lang = $translator->current_lang["code"];
$locale = $translator->current_lang["locale"];
$_SESSION["lang_code"] = $translator->current_lang["code"];
$_SESSION["lang_path"] = $translator->current_lang["path"];
include($translator->current_lang["path"]."/lang.php");
// Πίνακας $general_settings με τις γενικές ρυθμίσεις
$system->general_settings = $system->translateGeneralSettings($translator->current_lang["id"], $translator->default_lang["id"]);
$general_settings = $system->general_settings;
// Αποστολή συνδέσμου άρθρου σε φίλο και έξοδος
if (isset($article_mailto_send) and $myfield=="" and $_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id Αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας
{
if ($validator->validateGeneral($recipient_email) and $validator->validateEmail($recipient_email) and $validator->validateGeneral($sender_name) and $validator->validateGeneral($sender_email) and $validator->validateEmail($sender_email) and $validator->validateGeneral($email_subject))
{
$subject = $email_subject;
$body_message="<html><body>".sprintf(_ARTICLE_MAILTO_TEXT, $general_settings["site_url"], $sender_name, $sender_email, $url, $url)."</body></html>";
$sentstatus = $system->sendEmail($recipient_email, $email_subject, $body_message, $sender_email, $sender_name);
}
else
{
$sentstatus = false;
}
if ($sentstatus===true)
$msg = _MESSAGE_FORM_SUCCEDED;
else
$msg = _MESSAGE_FORM_FAILED;
// Ajax output
echo '<div id="ajax_output" class="hide"><div id="response_status">'.$sentstatus.'</div><div id="response_text">'.$msg.'</div></div>';
exit;
}
// Δημιουργία PDF
if ($makepdf==1)
{
$url =preg_replace('/&?makepdf=1/', '', $system->fullURL()); // Αφαίρεση της παραμέτρου makepdf=1 από το URL για να μπορεί να τραβήξει το κανονικό περιεχόμενο
$content->makePDF($url);
exit;
}
// Δημιουργία RSS
if ($action=="feed" and $feed=="rss2")
{
$content->rss($translator->current_lang["id"], $cat_ids);
exit;
}
// Εμφανίζει την πραγματικών διαστάσεων εικόνα με το δεδομένο photo_id από τα photo galleries
if ($action=="showphoto")
{
$galleries = new Photogalleries($connector, $system, $translator);
$myrow = $galleries->getPhotoById($photo_id);
if ($myrow==false)
{
$photopath = "images/core/image_not_found.gif";
}
else
{
$photopath = $myrow["filename"];
$phototype = strtolower(strstr($photopath, '.'));
$myrow = $galleries->getCategoryById($myrow["category_id"]);
$photopath = $galleries->photogalleries_path."/photos/".$myrow["catpath"]."/".$photopath;
$galleries->updatePhotoHits($photo_id); // Αύξηση των Hits της φωτογραφίας κατά ένα
}
header('Content-Type: image/jpeg');
readfile($photopath);
exit;
}
// Δημιουργία του πίνακα $menuData με τα μενού (κατηγορίες) και τις διασυνδέσεις μεταξύ τους
$categories->menuData = $categories->buildMenuData($translator->current_lang["id"], $general_settings["untranslated_categories_policy"]);
// Καθορισμός της τρέχουσας κατηγορίας και των παραμέτρων της
$categories->defineCurrentCategorySettings($cat_id, $id);
// Καθορισμός-τροποποίηση των category_settings ανάλογα με το δοσμένο $action
if ($action=="login_submit")
{
if (!$session->login($username, $password))
{
$loginerror = true;
$categories->category_settings["menu_type"] = 8;
$categories->category_settings["auth_page_type"] = 0;
$categories->category_settings["id"] = -1;
}
}
else if ($action=="logout")
{
$session->logout();
}
else if (isset($action))
{
$categories->actionController($action);
}
if ($validator->validateDate($date)==false) // Αν δωθεί μη έγκυρη ημερομηνία βάλε ημερομηνία τη σημερινή
$date = date("Y-m-d");
// Έλεγχος παραχώρησης πρόσβασης στο χρήστη στην τρέχουσα κατηγορία
if ($session->allowUserAccessToCategory($categories->category_settings)==false)
{
$categories->category_settings["menu_type"]=8;
$categories->category_settings["auth_page_type"]=0;
}
$category_settings = $categories->category_settings;
// ---------------------------------------------------------------------------------------------------
// Καθορισμός της κατάλληλης ενέργειας αναλόγως του τύπου της τρέχουσας κατηγορίας
// ---------------------------------------------------------------------------------------------------
if ($category_settings["menu_type"]==8) // Σελίδα σύνδεσης/εγγραφής/υπενθύμησης στοιχείων χρήστη
{
$html = "";
if ($category_settings["auth_page_type"]==0) // Σύνδεση χρήστη
{
if (isset($_SESSION["userid"]))
{
$contents_array["title"][0] = _USER_LOGOUT." ".$_SESSION["username"];
$html .= '<p>'._USER_LOGGED_IN_AS.' <em>'.$_SESSION['username'].'</em></p>';
$html .= '<div id="loginform"><form method="post" action="index.php">';
$html .= '<input type="hidden" name="action" value="logout" />';
$html .= '<input type="submit" name="submit" value="'._LOGOUT.'" />';
$html .= '</form></div>';
}
else
{
$contents_array["title"][0] = _USER_LOGIN;
if ($loginerror == true)
$html .= '<p class="error">'._USER_NOT_FOUND.'.</p>';
$html .= '<p>'._LOGIN_DESCRIPTION.':</p>';
$html .= '<div id="loginform"><form method="post" action="index.php'.($_SERVER['QUERY_STRING']!=""?"?".$_SERVER['QUERY_STRING']:"").'">';
$html .= '<input type="hidden" name="action" value="login_submit" />';
$html .= '<label for="username">'._USERNAME.'</label><input name="username" id="username" type="text" />';
$html .= '<label for="password">'._PASSWORD.'</label><input name="password" id="password" type="password" />';
$html .= '<input type="submit" name="submit" value="'._LOGIN.'" />';
$html .= '</form><ul>';
$html .= '<li><a href="index.php?action=lost_password_request">'._LOST_PASSWORD_QUESTION.'</a></li>';
if ($general_settings["user_allow_registration"]==1)
$html .= '<li><a href="index.php?action=register">'._CREATE_ACCOUNT.'</a></li>';
$html .= '</ul></div>';
}
}
else if ($category_settings["auth_page_type"]==1) // Εγγραφή-ενεργοποίηση χρήστη
{
$contents_array["title"][0] = _USER_REGISTRATION;
if ($general_settings["user_allow_registration"]==0) // Αν δεν επιτρέπεται η εγγραφή νέων μελών
{
$html = '<p class="error">'._NO_REGISTRATION_ALLOWED.'.</p>';
}
else
{
$registration_form_error = '';
if ($action=="register_submit" and $_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id Αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας
{
if (!$validator->validateGeneral($fullname) or !$validator->validateGeneral($username) or !$validator->validateGeneral($password) or !$validator->validateGeneral($password2) or !$validator->validateGeneral($email))
$registration_form_error = '<p class="error">'._FILL_ALL_REQUIRED_FIELDS.'.</p>';
else if ($password!=$password2)
$registration_form_error = '<p class="error">'._PASSWORD_CONFIRMATION_ERROR.'.</p>';
else if ($session->usernameExists($username))
$registration_form_error = '<p class="error">'._USERNAME_EXISTS.'.</p>';
else if (!$validator->validateEmail($email))
$registration_form_error = '<p class="error">'._GIVE_VALID_EMAIL.'.</p>';
else if ($session->userEmailExists($email))
$registration_form_error = '<p class="error">'._EMAIL_EXISTS.'.</p>';
}
if ($action=="register_submit" and $registration_form_error=="" and $_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας
{
$activation_code = SystemComponent::genRandomString(32);
$result = $session->insertUser($fullname, $username, $password, $email, $usergroup, $state, $activation_code, $general_settings);
if ($result==true)
{
$fullname = stripslashes($fullname); // αφαιρούνται τα slashes από ' και " για να εμφανιστούν σωστα στο μήνυμα του email
$username = stripslashes($username); // αφαιρούνται τα slashes από ' και " για να εμφανιστούν σωστα στο μήνυμα του email
$html = '<p class="success">'._REGISTRATION_COMPLETED.'!</p>';
if ($general_settings["user_new_account_activation"]==0)
{
$html .= '<p>'._REGISTRATION_NOWLOGIN.'.</p>';
$bodymessage = "<html><body>".sprintf(_REGISTRATION_EMAIL_AUTO_ACTIVATED, $fullname, $general_settings["site_url"], $general_settings["site_url"], $general_settings["site_url"])."</body></html>";
}
else if ($general_settings["user_new_account_activation"]==1)
{
$html .= '<p>'._REGISTRATION_COMPLETE_ACTIVATE.'.</p>';
$bodymessage = "<html><body>".sprintf(_REGISTRATION_EMAIL_LINK_ACTIVATED, $fullname, $general_settings["site_url"], $system->fullURL(), $activation_code, $system->fullURL(), $activation_code, $system->fullURL(), $system->fullURL(), $username, $password)."</body></html>";
}
else if ($general_settings["user_new_account_activation"]==2)
{
$html .= '<p>'._REGISTRATION_ADMIN_ACTIVATED.'.</p>';
$bodymessage = "<html><body>".sprintf(_REGISTRATION_EMAIL_ADMIN_ACTIVATED, $fullname, $general_settings["site_url"], $general_settings["site_url"], $general_settings["site_url"])."</body></html>";
}
// Αποστολή ενημερωτικού email εγγραφής νεου μέλους στο νέο χρήστη
$subject = sprintf(_REGISTRATION_EMAIL_SUBJECT, $fullname, $general_settings["site_url"]);
$sentstatus = $system->sendEmail($email, $subject, $bodymessage, $general_settings["owner_email"], _ONLINE_REGISTRATION_FORM);
// Αποστολή ενημερωτικού email εγγραφής νεου μέλους στον/στους Administrators
$subject = _REGISTRATION_ADMIN_EMAIL_SUBJECT." ".$general_settings["site_url"];
$bodymessage = "<html><body>".sprintf(_REGISTRATION_ADMIN_EMAIL_BODY, $general_settings["site_url"], date("d-m-Y H:i:s"), $fullname, $email, $email, $username)."</body></html>";
$admin_emails = $session->getAdminEmails();
$sentstatus = $system->sendEmail($admin_emails, $subject, $bodymessage, $general_settings["owner_email"], _ONLINE_REGISTRATION_FORM);
}
else
{
$html = '<p class="error">'._REGISTRATION_ERROR.'.</p>';
}
$_SESSION["prev_form_id"] = $form_id;
}
else if ($action=="activation")
{
if ($session->activateUser($activation_code))
$html = '<p class="success">'._ACTIVATION_SUCCESS.'!</p>';
else
$html = '<p class="error">'._ACTIVATION_ERROR.'.</p>';
}
else
{
$html = $registration_form_error;
$html .= '<div id="registration_profile_form"><form method="post" action="index.php">';
$html .= '<input type="hidden" name="action" value="register_submit" />';
$html .= '<input type="hidden" name="form_id" value="'.$system->genRandomString().'" />';
$html .= '<fieldset><legend>Βασικές πληροφορίες</legend>';
$html .= '<label for="fullname">'._FULLNAME.': <span class="star">*</span></label><input type="text" name="fullname" id="fullname" value="'.($registration_form_error!=""?$fullname:"").'" />';
$html .= '<label for="username">'._USERNAME.': <span class="star">*</span></label><input type="text" name="username" id="username" value="'.($registration_form_error!=""?$username:"").'" />';
$html .= '<label for="password">'._PASSWORD.': <span class="star">*</span></label><input type="password" name="password" id="password" />';
$html .= '<label for="password2">'._CONFIRM_PASSWORD.': <span class="star">*</span></label><input type="password" name="password2" id="password2" />';
$html .= '<label for="email">'._EMAIL.': <span class="star">*</span></label><input type="text" name="email" id="email" value="'.($registration_form_error!=""?$email:"").'" />';
$html .= '<p class="form_required"><span class="star">*</span> = '._REQUIRED_FIELDS.'</p>';
$html .= '</fieldset>';
$html .= '<input type="submit" name="submit" value="'._REGISTRATION.'" / onclick="return checkRegistrationForm(this.form, \'registration\');">';
$html .= '</form></div>';
}
}
}
else if ($category_settings["auth_page_type"]==2) // Επεξεργασία προφίλ χρήστη
{
$contents_array["title"][0] = _PROFILE_EDIT;
$update_profile_form_error = '';
if (isset($updateprofile) and $_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id Αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας
{
if (!$validator->validateGeneral($fullname) or !$validator->validateGeneral($username) or !$validator->validateGeneral($email))
$update_profile_form_error = '<p class="error">'._FILL_ALL_REQUIRED_FIELDS.'.</p>';
else if ($password!=$password2)
$update_profile_form_error = '<p class="error">'._PASSWORD_CONFIRMATION_ERROR.'.</p>';
else if (!$validator->validateEmail($email))
$update_profile_form_error = '<p class="error">'._GIVE_VALID_EMAIL.'.</p>';
else if (($email_exists_id=$session->userEmailExists($email)) and $email_exists_id!=$_SESSION["userid"])
$update_profile_form_error = $email_exists_id.'<p class="error">'._EMAIL_EXISTS.'.</p>';
}
if (isset($updateprofile) and $update_profile_form_error=="" and $_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας
{
$result = $session->updateUser($_SESSION["userid"], $fullname, $password, $email, $website, $address, $telephone, $signature);
if ($result==true)
{
$_SESSION["fullname"] = $fullname;
$_SESSION["email"] = $email;
$_SESSION["website"] = $website;
$_SESSION["address"] = $address;
$_SESSION["telephone"] = $telephone;
$_SESSION["signature"] = $signature;
$html = '<p class="success">'._PROFILE_UPDATE_SUCCESS.'!</p>';
}
else
$html = '<p class="error">'._PROFILE_UPDATE_ERROR.'.</p>';
$_SESSION["prev_form_id"] = $form_id;
}
else
{
$html = $update_profile_form_error;
$html .= '<div id="registration_profile_form"><form method="post" action="index.php?action=myaccount">';
$html .= '<input type="hidden" name="form_id" value="'.$system->genRandomString().'" />';
$html .= '<fieldset><legend>'._PROFILE.'</legend>';
$html .= '<label for="username">'._USERNAME.': </label><input name="username" id="username" type="text" value="'.$_SESSION["username"].'" readonly="readonly" class="readonly bold" />';
$html .= '<label for="username">'._REGISTRATION_DATE.': </label><input name="username" id="username" type="text" value="'.$system->formatDate($_SESSION["created"]).'" readonly="readonly" class="readonly" />';
$html .= '<label for="fullname">'._FULLNAME.': <span class="star">*</span></label><input name="fullname" id="fullname" type="text" value="'.$_SESSION["fullname"].'"/>';
$html .= '<label for="password">'._PASSWORD.':</label><input name="password" id="password" type="password" />';
$html .= '<label for="password2">'._CONFIRM_PASSWORD.':</label><input name="password2" id="password2" type="password" />';
$html .= '<label for="email">'._EMAIL.': <span class="star">*</span></label><input name="email" id="email" type="text" value="'.$_SESSION["email"].'" />';
$html .= '</fieldset><fieldset><legend>'._ADDITIONAL_INFO.'</legend>';
$html .= '<label for="website">'._WEBSITE.': </label><input name="website" id="website" type="text" value="'.$_SESSION["website"].'" />';
$html .= '<label for="address">'._ADDRESS.': </label><input name="address" id="address" type="text" value="'.$_SESSION["address"].'" />';
$html .= '<label for="telephone">'._TELEPHONE.': </label><input name="telephone" id="telephone" type="text" value="'.$_SESSION["telephone"].'" />';
$html .= '<label for="signature">'._SIGNATURE.': </label><textarea name="signature" id="signature">'.$_SESSION["signature"].'</textarea>';
$html .= '</fieldset>';
$html .= '<input name="updateprofile" type="submit" value="'._SAVE.'" / onclick="return checkRegistrationForm(this.form, \'profile\');">';
$html .= '</form></div>';
}
}
else if ($category_settings["auth_page_type"]==3) // Υπενθύμιση Κωδικού Πρόσβασης
{
$contents_array["title"][0] = _PASSWORD_REMINDER;
$html = "";
if ($action=="submit_new_password" and $myfield=="" and $_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id Αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας
{
if ($session->usernameEmailExists($username, $email))
{
$new_password = $system->genRandomString(10);
if ($session->updateUserPassword($username, $new_password))
{
$subject = sprintf(_PASSWORD_REMINDER_EMAIL_SUBJECT, $username, $general_settings["site_url"]);
$bodymessage = "<html><body>". sprintf(_PASSWORD_REMINDER_EMAIL_BODY, $username, $general_settings["site_url"], $new_password)."</body></html>";
$sentstatus = $system->sendEmail($email, $subject, $bodymessage, $general_settings["owner_email"], _ONLINE_PASSWORD_LOST_FORM);
if ($sentstatus===true)
$html .= '<p class="success">'._PASSWORD_REMINDER_SUCCESS.'!</p>';
else
$html .= '<p class="error">'._PASSWORD_REMINDER_SEND_EMAIL_ERROR.'.</p>';
}
else
{
$html .= '<p class="error">'.sprintf(_PASSWORD_REMINDER_ERROR, $username).'.</p>';
}
}
else
{
$html .= '<p class="error">'._PASSWORD_REMINDER_USER_NOT_FOUND.'.</p>';
}
$_SESSION["prev_form_id"] = $form_id;
}
$html .= '<p>'._PASSWORD_REMINDER_DESCRIPTION.'.</p>';
$html .= '<div id="loginform"><form method="post" action="index.php">';
$html .= '<input type="hidden" name="action" value="submit_new_password" />';
$html .= '<input type="hidden" name="form_id" value="'.$system->genRandomString().'" />';
$html .= '<input type="text" name="myfield" id="myfield" />';
$html .= '<label for="username">'._USERNAME.'</label><input name="username" id="username" type="text" />';
$html .= '<label for="email">'._EMAIL.'</label><input name="email" id="email" type="text" />';
$html .= '<input type="submit" name="submit" value="'._PASSWORD_REMINDER_SEND.'" />';
$html .= '</form></div>';
}
$contents_array["body"][0] = $html;
$contents_per_page = 1;
}
else if ($weblink!=0) // Μετάβαση σε Web σύνδεσμο
{
$result = $connector->query("SELECT * FROM content WHERE id=$weblink");
if ($myrow=$connector->fetchArray($result))
{
$content->updateContentHits($weblink); // Αύξησε τα hits του συνδέσμου κατά ένα
header("Location: ".$myrow["link"]);
exit;
}
}
else if ($id!=0 or $category_settings["menu_type"]==2) // Άντληση συγκεκριμένου άρθρου με δοσμένο id ή μενού με Link σε συγκεκριμένο άρθρο
{
if ($id==0)
$id = $category_settings["internal_link"];
$contents_array = $content->getSingleContent($id, true, true); // Δείξε και το ανενεργό ή outdated περιεχόμενο
if (!empty($contents_array) and count($contents_array)>0)
{
if ($contents_array["access"][0]==1 and $_SESSION["perm_frontend_view_registered_content"]==0) // Απαγόρεψε την πρόσβαση σε Ιδιωτικό περιεχόμενο και δείξε σελίδα Login
header("Location: index.php?action=login");
else
$contents_per_page = 1;
}
}
else if (in_array($category_settings["menu_type"], array(0,1,4,7))) // Πρωτοσέλιδα, Άρθρα κατηγορίας ή Σύνδεσμοι κατηγορίας ή Αρθρα άλλων διαφόρων κατηγοριών
{
$content_type = $categories->getContentType($category_settings["menu_type"]);
$cat_ids = array();
if ($category_settings["menu_type"]==0) // Πρωτοσέλιδα
{
$category_criteria = "frontpage=1";
}
else if ($category_settings["menu_type"]==1 or $category_settings["menu_type"]==4) // Άρθρα κατηγορίας ή σύνδεσμοι κατηγορίας
{
$category_criteria = "category_id=".$category_settings["id"];
if ($category_settings["show_submenu"]==2) // Πρόβαλε και τα άρθρα των υποκατηγοριών
$cat_ids = $categories->findAllChildCategories($category_settings["id"]);
}
else if ($category_settings["menu_type"]==7) // Άρθρα άλλων διαφόρων κατηγοριών
{
$category_criteria = "";
$cat_ids = explode(",",$category_settings["multiple_cat_ids"]);
}
if (!empty($cat_ids) and count($cat_ids)>0)
{
$extra_criteria = $system->buildCriteria($cat_ids, "category_id");
if ($category_criteria=="")
$category_criteria = "(".$extra_criteria.")";
else
$category_criteria = "(".$category_criteria." or ".$extra_criteria.")";
}
if ($listordertype!="ASC" and $listordertype!="DESC")
$listordertype="ASC";
if (isset($listordering) and $listordering!="title" and $listordering!="created" and $listordering!="userid")
$listordering="title";
if (isset($listordering))
$sort_order = "ORDER BY $listordering $listordertype";
else if ($category_settings["articles_sort_order"]==0)
$sort_order = "ORDER BY created DESC, id DESC";
else
$sort_order = "ORDER BY title ASC";
if ($_SESSION["perm_frontend_view_registered_content"]==0)
$access_level = "and access=0";
$sql = "SELECT * FROM content WHERE article_type=$content_type and $category_criteria and state=1 $access_level and publish_up<=NOW() and (publish_down > NOW() or publish_down='0000-00-00 00:00:00') $sort_order LIMIT $start,".$category_settings["articles_per_page"];
$sql = $translator->fixSqlStatement($sql, $translator->current_lang["id"], "content", $general_settings["untranslated_articles_policy"]);
$contents_array = $content->getContents($sql);
$total_contents = $content->total_contents;
$contents_per_page = $content->contents_per_page;
}
else if ($category_settings["menu_type"]==3 and $id==0) // Μενού προς εξωτερικό σύνδεσμο
{
$result = $connector->query("SELECT * FROM categories WHERE id=".$category_settings["id"]);
if ($myrow = $connector->fetchArray($result) and $myrow["external_link"]!="")
{
header("Location: ".$myrow["external_link"]);
exit;
}
}
else if ($category_settings["menu_type"] == 5) // Αναζήτηση
{
$is_searchpage = true;
if ($search_in=="contacts" or $category_settings["search_in"]==1) // Αναζήτηση στις επαφές
{
$search = new Search($connector);
$query = $search->cleanQuery($query);
if ($query!="")
{
$search->query = $query;
$search_results = $search->searchContactsEngine($translator->current_lang["id"], $_SESSION["perm_frontend_view_registered_content"]);
$numofresults = (!empty($search_results['title'])?count($search_results['title']):0);
}
else
{
$numofresults = 0;
}
$html = "";
$html .= '<div id="search_info">';
$html .= '<p><strong>'._SEARCH_IN_CONTACTS.'</strong></p>';
if ($action=="search")
{
$html .= '<p>'._SEARCH_KEYWORDS.': <strong>'.$query.'</strong>';
$html .= '<br/>'._RESULTS.': <strong id="num_of_results">'.$numofresults.'</strong></p>';
}
$html .= '<form method="post" action="index.php">';
$html .= '<label for="query">'._NEW_SEARCH.':</label>';
$html .= '<input type="hidden" name="cat_id" value="'.$category_settings["id"].'"/>';
$html .= '<input type="hidden" name="search_in" value="contacts"/>';
$html .= '<input type="text" name="query" id="query"/>';
$html .= '<input type="hidden" name="action" value="search" />';
$html .= '<input type="submit" name="submit" value="'._SEARCH.'" />';
$html .= '</form></div>';
$html .= '<div id="search_results">';
if ($numofresults>0)
{
$html .= '<ol>';
for ($k=0; $k<$numofresults; ++$k)
{
if ($translator->current_lang["id"] == $translator->default_lang["id"]) // Αποτελέσματα από την default γλώσσα
{
$result_cat = $contacts->getCategoryById($search_results['cat_id'][$k]);
}
else
{
$result_cat = $translator->fetchTranslatedContent($translator->current_lang["id"], $search_results['cat_id'][$k], "contacts_cats");
}
$html .= '<li><h4>'.$search_results['title'][$k].'</h4>';
$html .= '<h5>'.$result_cat['title'].'</h5>';
$search_results['full_address'][$k] = $search_results["city"][$k].(($search_results["city"][$k]!="" and $search_results["country"][$k]!="")?", ":"").$search_results["country"][$k].($search_results["zipcode"][$k]!=""?" - "._ZIPCODE." ":"").$search_results["zipcode"][$k];
$html .= '<ul>';
if ($search_results['address'][$k]!="" or $search_results['full_address'][$k]!="")
$html .= '<li>'._ADDRESS.': ';
if ($search_results['address'][$k]!="")
$html .= $search_results['address'][$k];
if ($search_results['address'][$k]!="" and $search_results['full_address'][$k]!="")
$html .= ', ';
if ($search_results['full_address'][$k]!="")
$html .= $search_results['full_address'][$k];
if ($search_results['address'][$k]!="" or $search_results['full_address'][$k]!="")
$html .= '</li>';
if ($search_results['tel'][$k]!="")
$html .= '<li>'._TELEPHONE.': '.$search_results['tel'][$k].'</li>';
if ($search_results['fax'][$k]!="")
$html .= '<li>'._FAX.': '.$search_results['fax'][$k].'</li>';
if ($search_results['cellphone'][$k]!="")
$html .= '<li>'._CELLPHONE.': '.$search_results['cellphone'][$k].'</li>';
if ($search_results['email'][$k]!="")
$html .= '<li>'._EMAIL.': <a href="mailto:'.$search_results['email'][$k].'">'.$search_results['email'][$k].'</a></li>';
if ($search_results['website'][$k]!="")
$html .= '<li>'._WEBSITE.': <a href="'.$search_results['website'][$k].'">'.$search_results['website'][$k].'</a></li>';
$html .= '</ul></li>';
}
$html .= '</ol>';
}
else if ($query!="") // Εμφάνισε οδηγίες αναζήτησης μόνο αν δεν έχει δωθεί κενό $query και δεν έχουν βρεθεί αποτελέσματα
{
$html .= '<p>'.sprintf(_NO_SEARCH_RESULTS, $query).'</p>';
$html .= '<p>'._SUGGESTIONS.':<ul><li>'._CHECK_KEYWORD_GRAMMAR.'.</li><li>'._TRY_OTHER_KEYWORDS.'.</li><ul>';
}
$html .= "</div>";
}
else if ($search_in=="catalogue" or $category_settings["search_in"]==2) // Αναζήτηση στον Ldap
{
$ldapconnector = new LdapConnector();
$search = new Search($ldapconnector, true);
$query = $search->cleanQuery($query);
$filter = "";
if ($query!="")
{
$filter1 = "";
$filter2 = "";
foreach ($ldap_fields as $ldap_field)
{
if ($ldap_field["type"]=="text")
{
$filter1 .= "(".$ldap_field["name"]."=*".strtr(trim($query),"άέόίύήώς","αεοιυηωσ")."*)";
}
else if ($ldap_field["type"]=="select")
{
if (!empty($ldap_field["options"]) and count($ldap_field["options"])>0)
{
$tmp = "";
foreach ($ldap_field["options"] as $option)
{
$tmp .= "(".$ldap_field["name"]."=".$option["value"].")";
}
$filter2 .= "(|".$tmp.")";
}
}
}
$filter = "(&(|".$filter1.")(&".$filter2."))";
}
else
{
if (!empty($ldap_fields) and count($ldap_fields)>0)
{
foreach ($ldap_fields as $ldap_field)
{
if (${$ldap_field["name"]}!="")
{
if ($ldap_field["type"]=="text")
{
$filter .= "(".$ldap_field["name"]."=*".strtr(trim(${$ldap_field["name"]}),"άέόίύήώς","αεοιυηωσ")."*)";
}
else if ($ldap_field["type"]=="select")
{
if (${$ldap_field["name"]}=="any")
{
if (!empty($ldap_field["options"]) and count($ldap_field["options"])>0)
{
$tmp = "";
foreach ($ldap_field["options"] as $option)
{
$tmp .= "(".$ldap_field["name"]."=".$option["value"].")";
}
$filter .= "(|".$tmp.")";
}
}
else
{
$filter .= "(".$ldap_field["name"]."=".${$ldap_field["name"]}.")";
}
}
else if ($ldap_field["type"]=="hidden" and ${$ldap_field["name"]}!="")
{
$filter .= "(".$ldap_field["name"]."=".${$ldap_field["name"]}.")";
}
}
}
}
}
if ($filter!="")
{
$max_results = LDAP_MAX_RESULTS;
$filter = "(&".$filter.")";
$attributes = array("*");
$info = $search->searchLdapEngine($filter, $attributes, $max_results, $lang);
if ($info["count"]>$max_results)
$numofresults = $max_results;
else
$numofresults = $info["count"];
}
$html = "";
$html .= '<div id="search_info">';
$html .= '<p><strong>'._SEARCH_IN_CATALOGUE.'</strong></p>';
if ($action=="search")
{
$html .= '<p>'._RESULTS.': <strong id="num_of_results">'.(int)$numofresults.'</strong></p>';
}
$html .= '<form method="post" action="index.php">';
$html .= '<input type="hidden" name="cat_id" value="'.$category_settings["id"].'"/>';
$html .= '<input type="hidden" name="search_in" value="catalogue"/>';
$html .= '<input type="hidden" name="action" value="search" />';
if (!empty($ldap_fields) and count($ldap_fields)>0)
{
foreach ($ldap_fields as $ldap_field)
{
if ($ldap_field["type"]=="text")
{
$html .= '<div><label>'.$ldap_field["title_".$lang].':</label><input type="text" name="'.$ldap_field["name"].'" value="'.${$ldap_field["name"]}.'"></div>';
}
else if ($ldap_field["type"]=="select")
{
$html .= '<div><label>'.$ldap_field["title_".$lang].':</label><select name="'.$ldap_field["name"].'">';
$html .= '<option value="any">'._ΑΝΥ.'</option>';
if (!empty($ldap_field["options"]) and count($ldap_field["options"])>0)
{
foreach ($ldap_field["options"] as $option)
{
$html .= '<option value="'.$option["value"].'"'.(${$ldap_field["name"]}==$option["value"]?" selected":"").'>'.$option["label_".$lang].'</option>';
}
}
$html .= '</select></div>';
}
else if ($ldap_field["type"]=="hidden")
{
$html .= '<input type="hidden" name="'.$ldap_field["name"].'" value="'.$ldap_field["value"].'">';
}
}
}
$html .= '<div><input type="submit" name="submit" value="'._SEARCH.'" /></div>';
$html .= '</form>';
if ($numofresults==0 or $action!="search")
{
$html .= _LDAP_SEARCH_INFO;
}
if ($info["count"]>$max_results)
$html .= '<p class="txtsmall"><em>(Ξεπεράστηκε το μέγιστο επιτρεπτό πλήθος εγγραφών ανά αναζήτηση. Δοκιμάστε να αναζητήσετε με περισσότερα στοιχεία όπως πλήρες επώνυμο, τμήμα ή ιδιότητα.)</em></p>';
$html .= '</div>';
if ($numofresults>0)
{
$html .= '<div id="search_results">';
$html .= '<ol id="ldap_results">';
for ($i=0; $i<$numofresults; $i++)
{
if (!empty($ldap_fields) and count($ldap_fields)>0)
{
foreach ($ldap_fields as $ldap_field)
{
if ($ldap_field["type"]=="text" or $ldap_field["type"]=="hidden" or $ldap_field["type"]=="result")
{
if ($lang!="en" and $info[$i][$ldap_field["name"].";lang-".$lang][0]!="")
${$ldap_field["name"]} = $info[$i][$ldap_field["name"].";lang-".$lang][0];
else
${$ldap_field["name"]} = $info[$i][$ldap_field["name"]][0];
if (!empty($ldap_field["like"]))
{
${$ldap_field["name"]} = str_replace(array(" ","-","+"), "", ${$ldap_field["name"]});
if (!strstr(${$ldap_field["name"]}, $ldap_field["like"]))
${$ldap_field["name"]} = "";
}
}
else if ($ldap_field["type"]=="select")
{
if (!empty($ldap_field["options"]) and count($ldap_field["options"])>0)
{
foreach ($ldap_field["options"] as $option)
{
$found_subcat = false;
if ($option["subcat"]!="")
{
foreach ($ldap_fields as $l_field)
{
if ($l_field["name"]==$option["subcat"])
break;
}
if ($l_field["name"]==$option["subcat"] and !empty($l_field["options"]) and count($l_field["options"])>0)
{
foreach ($l_field["options"] as $l_option)
{
if ($info[$i][$l_field["name"]][0]==$l_option["value"])
{
${$ldap_field["name"]} = $l_option["label_".$lang];
$found_subcat = true;
}
}
}
}
if ($found_subcat==false)
{
if ($info[$i][$ldap_field["name"]][0]==$option["value"])
{
${$ldap_field["name"]} = $option["label_".$lang];
}
}
}
}
}
}
}
$html .= '<li><h4>'.${$ldap_fields[0]["name"]}.' ' .${$ldap_fields[1]["name"]};
$html .= '<form action="vcard.php" method="post">';
$html .= '<input src="images/core/vcard.gif" type="image" border="0" alt="vCard" title="vCard">';
$html .= '<input name="last_name" value="'.${$ldap_fields[$vcard_fields["last_name"]]["name"]}.'" type="hidden">';
$html .= '<input name="first_name" value="'.${$ldap_fields[$vcard_fields["first_name"]]["name"]}.'" type="hidden">';
$html .= '<input name="company" value="'.${$ldap_fields[$vcard_fields["department"]]["name"]}.'" type="hidden">';
$html .= '<input name="office_tel" value="'.${$ldap_fields[$vcard_fields["office_tel"]]["name"]}.'" type="hidden">';
$html .= '<input name="email1" value="'.${$ldap_fields[$vcard_fields["email1"]]["name"]}.'" type="hidden">';
$html .= '<input name="title" value="'.${$ldap_fields[$vcard_fields["title"]]["name"]}.'" type="hidden">';
$html .= '<input name="url" value="'.${$ldap_fields[$vcard_fields["url"]]["name"]}.'" type="hidden">';
$html .= '</form></h4><ul>';
$c = 0;
$cc = (!empty($ldap_fields)?count($ldap_fields):0);
for ($k=2; $k<=($cc-1); ++$k)
{
if ($ldap_fields[$k]["type"]=="text" or $ldap_fields[$k]["type"]=="select" or $ldap_fields[$k]["type"]=="result")
{
if ($c%2==0)
$html .= '<li>';
if ($k<(count($ldap_fields)-1) or $c%2==1)
$html .= '<span>';
$html .= $ldap_fields[$k]["title_".$lang].': ';
if ($ldap_fields[$k]["special"]=="url")
$html .= '<a href="'.${$ldap_fields[$k]["name"]}.'" target="_blank">';
if ($ldap_fields[$k]["special"]=="email")
$html .= '<a href="mailto:'.${$ldap_fields[$k]["name"]}.'">';
$html .= ${$ldap_fields[$k]["name"]};
if ($ldap_fields[$k]["special"]=="email" or $ldap_fields[$k]["special"]=="url")
$html .= '</a>';
if ($k<(count($ldap_fields)-1) or $c%2==1)
$html .= '</span>';
if ($c%2==1)
$html .= '</li>';
++$c;
}
}
$html .= '</ul></li>';
}
$html .= '</ol>';
$html .= '</div>';
}
}
else // Αναζήτηση στα Άρθρα
{
$search = new Search($connector);
$query = $search->cleanQuery($query);
if (!isset($search_ignore)) // To $search_ignore ορίζεται στο lang.php
$search_ignore = array();
if ($search->isCommonKey($query,$search_ignore))
{
$common_key = true;
$numofresults = 0;
}
else if ($search->isShortKey($query,2))
{
$short_key = true;
$numofresults = 0;
}
else
{
$query = $search->removeShortKeys($query, 2); // Αφαίρεσε λέξεις 1 ή 2 χαρακτήρων
$query = $search->removeCommonKeys($query, $search_ignore); // Αφαίρεσε από το query string τα common words
$search->query = $query;
$search_results = $search->searchEngine($translator->current_lang["id"], $_SESSION["perm_frontend_view_registered_content"]);
$numofresults = (!empty($search_results['title'])?count($search_results['title']):0);
}
$html = "";
$html .= '<div id="search_info">';
$html .= '<p><strong>'._SEARCH_IN_WEBSITE.'</strong></p>';
if ($action=="search")
{
$html .= '<p>'._SEARCH_KEYWORDS.': <strong>'.$query.'</strong>';
$html .= '<br/>'._RESULTS.': <strong id="num_of_results">'.$numofresults.'</strong></p>';
}
$html .= '<form method="post" action="index.php">';
$html .= '<label for="query">'._NEW_SEARCH.':</label>';
$html .= '<input type="hidden" name="cat_id" value="'.$category_settings["id"].'"/>';
$html .= '<input type="text" name="query" id="query"/>';
$html .= '<input type="hidden" name="action" value="search" />';
$html .= '<input type="submit" name="submit" value="'._SEARCH.'" />';
$html .= '</form></div>';
$html .= '<div id="search_results">';
if ($common_key==true)
{
$html .= '<p>'._KEYWORDS_IGNORED.'.';
}
else if ($short_key==true)
{
$html .= '<p>'._KEYWORD_MIN_CHARACTERS.'.';
}
else if ($numofresults>0)
{
$html .= '<ol>';
$k=0;
foreach ($search_results['title'] as $entry)
{
$result_cat_path = $categories->buildCategoryPath($search_results['cat_id'][$k], $translator->current_lang["id"]);
$html .= '<li><h4><a href="index.php?cat_id='.$search_results['cat_id'][$k].'&id='.$search_results['id'][$k].'">'.$entry.'</a></h4>';
$html .= '<h5>';
$ccc = (!empty($result_cat_path['title'])?count($result_cat_path['title']):0);
for ($i=0; $i<$ccc; ++$i)
{
if ($i==0)
$html .= '(';
else
$html .= '/';
$html .= $result_cat_path['title'][$i];
}
if ($i>0)
$html .= ')';
$html .= '</h5>';
$html .= $search_results['text'][$k].'</li>';
++$k;
}
$html .= '</ol>';
}
else
{
$html .= '<p>'.sprintf(_NO_SEARCH_RESULTS, $query).'</p>';
$html .= '<p>'._SUGGESTIONS.':<ul><li>'._CHECK_KEYWORD_GRAMMAR.'.</li><li>'._TRY_OTHER_KEYWORDS.'.</li><ul>';
}
$html .= "</div>";
}
$contents_array["title"][0] = _SEARCH;
$contents_array["body"][0] = $html;
$contents_per_page = 1;
}
else if ($category_settings["menu_type"]==6) // Στοιχεία επικοινωνίας/επαφή
{
$params = $categories->getContactParametersArray();
if ($category_settings["contact_type"]==0 or empty($category_settings["contact_id"])) // Στοιχεία κατόχου ιστοσελίδας
{
$con_title = $general_settings["owner_name"];
$con_address = $general_settings["owner_address"];
$con_fulladress = $general_settings["owner_city"].(($general_settings["owner_city"]!="" and $general_settings["owner_country"]!="")?", ":"").$general_settings["owner_country"].($general_settings["owner_zipcode"]!=""?" - "._ZIPCODE." ":"").$general_settings["owner_zipcode"];
$con_tel = $general_settings["owner_tel"];
$con_fax = $general_settings["owner_fax"];
$con_cellphone = $general_settings["owner_cellphone"];
$con_email = $general_settings["owner_email"];
$con_website = $general_settings["site_url"];
$con_extra_info = $general_settings["extra_info"];
$con_image = "";
}
else // Άλλη μεμονωμένη επαφή
{
$contact = $contacts->getContactById($category_settings["contact_id"]);
$con_title = $contact["title"];
$con_address = $contact["address"];
$con_fulladress = $contact["city"].(($contact["city"]!="" and $contact["country"]!="")?", ":"").$contact["country"].($contact["zipcode"]!=""?" - "._ZIPCODE." ":"").$contact["zipcode"];
$con_tel = $contact["tel"];
$con_fax = $contact["fax"];
$con_cellphone = $contact["cellphone"];
$con_email = $contact["email"];
$con_website = $contact["website"];
$con_extra_info = $contact["extra_info"];
$con_image = $contact["image"];
}
$html = "";
if (isset($contact_form_submit) and $myfield=="" and $_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id Αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας
{
if (!$validator->validateGeneral($contact_fullname))
$html .= '<p class="error">'._GIVE_FULLNAME.'.</p>';
else if (!$validator->validateGeneral($contact_email))
$html .= '<p class="error">'._GIVE_EMAIL.'.</p>';
else if (!$validator->validateEmail($contact_email))
$html .= '<p class="error">'._GIVE_VALID_EMAIL.'.</p>';
else if (!$validator->validateGeneral($contact_msg))
$html .= '<p class="error">'._WRITE_MESSAGE.'.</p>';
else // Αποστολή μηνύματος
{
$subject=_ONLINE_FORM_FROM." ".$general_settings["site_url"];
$bodymessage="<html><body>".sprintf(_ONLINE_FORM_ENTRY_TEXT, $general_settings["site_url"]).":<br/>
<br/><strong>"._ONLINE_FORM_FULLNAME.":</strong> ".$contact_fullname."
<br/><strong>"._ONLINE_FORM_EMAIL.":</strong> ".$contact_email."
<br/><strong>"._ONLINE_FORM_SUBJECT.":</strong> ".$contact_subject."
<br/>
<br/><strong>"._ONLINE_FORM_VISITOR_MESSAGE.":</strong>
<br/>-------------------------------------
<br/>".$contact_msg."</body></html>";
$sentstatus = $system->sendEmail($con_email, $subject, $bodymessage, $general_settings["owner_email"], _ONLINE_CONTACT_FORM);
if ($sentstatus===true)
$html .= '<p class="success">'._ΤΗΑΝΚ_MESSAGE.'!</p>';
else
$html .= '<p class="error">'._MESSAGE_FORM_FAILED.'. '.$sentstatus.'</p>';
$_SESSION["prev_form_id"] = $form_id;
}
}
if ($con_title!="" and $params[0]==1)
$html .= '<h4>'.$con_title.'</h4>';
if ($con_image!="" and $params[9]==1)
$html .= '<p class="contact_image"><img src="'.$con_image.'"></p>';
$html .= '<ul class="contact_info">';
if ($con_address!="" and $params[1]==1)
{
$html .= '<li><span class="contact_info_title contact_address">'._ADDRESS.':</span><span>';
if ($con_address!="")
$html .= $con_address;
if ($con_fulladress!="")
$html .= '<br />'.$con_fulladress;
$html .= '</span></li>';
}
if ($con_tel!="" and $params[2]==1)
$html .= '<li><span class="contact_info_title contact_telephone">'._TELEPHONE.':</span><span>'.$con_tel.'</span></li>';
if ($con_fax!="" and $params[3]==1)
$html .= '<li><span class="contact_info_title contact_fax">'._FAX.':</span><span>'.$con_fax.'</span></li>';
if ($con_cellphone!="" and $params[4]==1)
$html .= '<li><span class="contact_info_title contact_cellphone">'._CELLPHONE.':</span><span>'.$con_cellphone.'</span></li>';
if ($con_email!="" and $params[5]==1)
$html .= '<li><span class="contact_info_title contact_email">'._EMAIL.':</span><span><a href="mailto:'.$con_email.'">'.$con_email.'</a></span></li>';
if ($con_website!="" and $params[6]==1)
$html .= '<li><span class="contact_info_title contact_url">'._WEBSITE.':</span><span><a href="'.$con_website.'">'.$con_website.'</a></span></li>';
if ($con_extra_info!="" and $params[7]==1)
$html .= '<li class="contact_extra_info">'.$con_extra_info.'</li>';
$html .= '</ul><div class="clear"></div>';
if ($params[8]==1)
{
$html .= '<h5>'._CONTACT_FORM.'</h5>';
$html .= '<form name="contact_form" id="contact_form" method="post" action="index.php">';
$html .= '<input type="hidden" name="cat_id" value="'.$category_settings["id"].'" />';
$html .= '<input type="hidden" name="form_id" value="'.$system->genRandomString().'" />';
$html .= '<input type="text" name="myfield" id="myfield" />';
$html .= '<div><label for="contact_fullname"><span class="star">*</span> '._FULLNAME.':</label><input type="text" name="contact_fullname" id="contact_fullname" value="'.$contact_fullname.'" size="30" /></div>';
$html .= '<div><label for="contact_email"><span class="star">*</span> '._EMAIL.':</label><input type="text" id="contact_email" name="contact_email" value="'.$contact_email.'" size="30" maxlength="100" /></div>';
$html .= '<div><label for="contact_subject">'._SUBJECT.':</label><input type="text" name="contact_subject" id="contact_subject" value="'.$contact_subject.'" size="30" /></div>';
$html .= '<div><label for="contact_msg"><span class="star">*</span> '._MESSAGE.':</label><textarea name="contact_msg" id="contact_msg" cols="55" rows="8">'.$contact_msg.'</textarea></div>';
$html .= '<div><label> </label><input type="submit" id="contact_form_submit" name="contact_form_submit" value="'._SEND.'" onclick="return checkContactForm(this.form);" /></div>';
$html .= '<p class="form_required"><span class="star">*</span> = '._REQUIRED_FIELDS.'</p>';
$html .= '</form>';
}
$contents_array["title"][0] = $category_settings["title"];
$contents_array["body"][0] = $html;
$contents_per_page = 1;
}
else if ($category_settings["menu_type"] == 9) // Φωτογραφικά άλμπουμ
{
$root_parent_id = (int) $categories->category_settings["photogallery_id"];
if ($gallery_id!=0)
{
$categories->category_settings["photogallery_id"] = $gallery_id;
$category_settings["photogallery_id"] = $gallery_id;
}
if (empty($category_settings["photogallery_id"]))
$parent_category["id"] = 0;
else
$parent_category = $galleries->getCategoryById($category_settings["photogallery_id"]);
$parents_array = $galleries->buildCategoryPath($parent_category["id"], $tranlator->current_lang["id"]);
$parents_array = array_merge(array(0=>array('id'=>0, 'title'=>'')), $parents_array); // Προσθέτει και την εικονική κατηγορία άλμπουμ με id=0 που είναι θεωρητικά η root κατηγορία όλων των κατηγοριών
$subcategories_array = $galleries->getSubCategories($parent_category["id"], $galleries->photogalleries_settings["categoriesordering"], true); // Επιστρέφει όλες τις υποκατηγορίες, εκτός από τις κενές
$photos_array = $galleries->getPhotosByParentCategory($category_settings["photogallery_id"], $galleries->photogalleries_settings["photosordering"]);
$parents_path = "";
$root_parent_found = false;
foreach ($parents_array as $parent)
{
if ($parent["id"]==$root_parent_id)
{
$root_parent_found = true;
$parents_path .= '<a href="index.php?cat_id='.$category_settings["id"].'">'._HOME.'</a>'.$parents_path;
}
else if ($root_parent_found == true)
{
$translated_parent = $galleries->translatedFields($parent["id"], 1);
foreach ($translated_parent as $key=>$value)
{
if ($value!="")
$parent[$key] = $value;
}
if ($parent["id"]!=$category_settings["photogallery_id"])
$parents_path .= ($parents_path!=""?" » ":"").'<a href="index.php?cat_id='.$category_settings["id"].'&gallery_id='.$parent["id"].'">'.$parent["title"].'</a>';
else
$parents_path .= ($parents_path!=""?" » ":"").$parent["title"];
}
}
if ($parents_path=="")
$parents_path .= '<a href="index.php?cat_id='.$category_settings["id"].'">'._HOME.'</a>';
$html = '';
$html .= '<div id="photogallery">';
$html .= '<div class="gallery_path">'.$parents_path.'</div>';
if (!empty($subcategories_array) and count($subcategories_array)>0)
{
$html .= '<div class="gallery_title">'._SUB_CATEGORIES.'</div>';
$subcategories_in_page = 0;
for ($i=$start1; $i<min(count($subcategories_array), ($start1+$galleries->photogalleries_settings["categoriesperpage"])); ++$i)
{
$category_total_photos = $galleries->getCategoryTotalNumOfPhotos($subcategories_array[$i]["id"], true);
$translated_fields = $galleries->translatedFields($subcategories_array[$i]["id"], 1);
foreach ($translated_fields as $key=>$value)
{
if ($value!="")
$subcategories_array[$i][$key] = $value;
}
if ($subcategories_in_page%$galleries->photogalleries_settings["categoriescolumns"]==0)
$html .= '<div class="thumbnails_row">';
$html .= '<div class="thumbnail_item" style="width: '.floor(100/$galleries->photogalleries_settings["categoriescolumns"]).'%">';
$html .= '<a href="index.php?cat_id='.$category_settings["id"].'&gallery_id='.$subcategories_array[$i]["id"].'" title="'.$subcategories_array[$i]["title"].'">';
$thumb_filename = "";
if ($galleries->photogalleries_settings["showcatthumbnail"]==1) // Τυχαία φωτογραφία για μικρογραφία κατηγορίας
{
$thumb_filename = $galleries->getCategoryRandomThumbnail($subcategories_array[$i]["id"]);
}
else if ($galleries->photogalleries_settings["showcatthumbnail"]==2) // Δείξε ως μικρογραφία την φωτογραφία που επιλέχθηκε στις ρυθμίσεις της κατηγορίας
{
if ($subcategories_array[$i]["catimage"]!="")
$thumb_filename = $subcategories_array[$i]["catpath"].'/'.$subcategories_array[$i]["catimage"];
}
if ($thumb_filename != "")
{
$thumb_filename = $galleries->photogalleries_path.'/thumbnails/'.$thumb_filename;
$imgclass = '';
}
else
{
$thumb_filename = "images/core/pictures_folder.png";
$imgclass = ' class="plain"';
}
$html .= '<img src="'.$thumb_filename.'"'.$imgclass.' /></a>';
$html .= '<ul class="category_info">';
$html .= '<li><strong>'.$subcategories_array[$i]["title"].'</strong></li>';
$html .= '<li>('.$category_total_photos.' '._PHOTOS.')</li>';
if ($subcategories_array[$i]["description"]!="")
$html .= '<li>'.$subcategories_array[$i]["description"].'</li>';
$html .= '</ul></div>';
++$subcategories_in_page;
if ($subcategories_in_page%$galleries->photogalleries_settings["categoriescolumns"]==0 or $subcategories_in_page==$galleries->photogalleries_settings["categoriesperpage"] or $i==(count($subcategories_array)-1))
{
$html .= '</div><div class="clear"></div>';
}
}
$pagination1 = $galleries->buildGalleriesPagination($categories->category_settings['id'], $category_settings["photogallery_id"], count($subcategories_array), $start1, $start2, 1);
if ($pagination1!="")
$html .= '<div class="pagination">'.$pagination1.'</div>';
}
if (!empty($photos_array) and count($photos_array)>0)
{
$fancybox_parameters = unserialize($galleries->photogalleries_settings["fancybox"]);
$html .= '<script type="text/javascript">';
$html .= '$(function() {$(".photo_thumb a").fancybox({type:"image", openEffect:"elastic", padding: '.$fancybox_parameters["fancyboxpadding"].', closeEffect:"elastic", openOpacity: true, helpers:{overlay:{opacity:0.6}}});});';
$html .= '</script>';
$html .= '<div class="gallery_title">'.$parent_category["title"].'</div>';
$html .= '<div class="gallery_description">'.$parent_category["description"].'</div>';
$photos_in_page = 0;
for ($i=$start2; $i<min(count($photos_array), ($start2+$galleries->photogalleries_settings["photosperpage"])); ++$i)
{
$translated_fields = $galleries->translatedFields($photos_array[$i]["id"]);
foreach ($translated_fields as $key=>$value)
{
if ($value!="")
$photos_array[$i][$key] = $value;
}
if ($photos_in_page%$galleries->photogalleries_settings["photoscolumns"]==0)
$html .= '<div class="thumbnails_row">';
$html .= '<div class="thumbnail_item photo_thumb" style="width: '.floor(100/$galleries->photogalleries_settings["photoscolumns"]).'%">';
$html .= '<a href="index.php?action=showphoto&photo_id='.$photos_array[$i]["id"].'" rel="gallery" title="'.$photos_array[$i]["title"].($photos_array[$i]["description"]!=""?" - ".$system->stripHTMLTags($photos_array[$i]["description"],""):"").'">';
$html .= '<img src="'.$galleries->photogalleries_path.'/thumbnails/'.$parent_category["catpath"].'/'.$photos_array[$i]["filename"].'" /></a>';
$html .= '<ul class="photo_info">';
$html .= '<li><strong>'.$photos_array[$i]["title"].'</strong></li>';
//$html .= '<li>('.$galleries->getCategoryTotalNumOfPhotos($parent_category["id"], true).' Φωτογραφίες)</li>';
if ($photos_array[$i]["description"]!="")
$html .= '<li>'.$photos_array[$i]["description"].'</li>';
$html .= '<li>'._HITS.': '.$photos_array[$i]["hits"].'</li>';
$html .= '</ul></div>';
++$photos_in_page;
if ($photos_in_page%$galleries->photogalleries_settings["photoscolumns"]==0 or $photos_in_page==$galleries->photogalleries_settings["photosperpage"] or $i==(count($photos_array)-1))
{
$html .= '</div><div class="clear"></div>';
}
}
$pagination2 = $galleries->buildGalleriesPagination($categories->category_settings['id'], $category_settings["photogallery_id"], count($photos_array), $start1, $start2, 2);
if ($pagination2!="")
$html .= '<div class="pagination">'.$pagination2.'</div>';
}
$html .= '</div>';
$contents_array["title"][0] = $category_settings["title"];
$contents_array["body"][0] = $html;
$c1 = (!empty($subcategories_array)?count($subcategories_array):0);
$c2 = (!empty($photos_array)?count($photos_array):0);
$total_contents = $c1 + $c2;
if ($total_contents>0)
$contents_per_page = 1;
else
$contents_per_page = 0;
}
else if ($category_settings["menu_type"]==11) // Site Map
{
$html = '<div class="site_map">'.$categories->buildMenu(0).'</div>';
$contents_array["title"][0] = $category_settings["title"];
$contents_array["body"][0] = $html;
$contents_per_page = 1;
}
else if ($category_settings["menu_type"]==12) // Λίστα επαφών κατηγορίας
{
$params = $categories->getContactParametersArray();
$childcategories = $contacts->buildCategoriesDataTableArrayTranslated(1, "sort_order", "ASC", $category_settings["contact_category_id"]); // Πίνακας με όλες τις επαφές της κατηγορίας και των υποκατηροριών της
$html = '';
if (!empty($category_settings["contact_category_id"]))
{
$start_contact_category = $contacts->getCategoryById($category_settings["contact_category_id"]);
$html .= '<h4>'.$start_contact_category["title"].'</h4>';
}
else
{
//$html .= '<h4>Επαφές</h4>';
}
$colspan = 1;
for ($i=0; $i<=6; ++$i)
{
++$colspan;
}
$html .= '<table class="contacts_list"><tr>';
$col = 0;
if ($params[0]==1)
$html .= '<th class="col_'.(++$col).'">'._FULLNAME.'</td>';
if ($params[1]==1)
$html .= '<th class="col_'.(++$col).'">'._ADDRESS.'</td>';
if ($params[2]==1)
$html .= '<th class="col_'.(++$col).'">'._TELEPHONE.'</td>';
if ($params[3]==1)
$html .= '<th class="col_'.(++$col).'">'._FAX.'</td>';
if ($params[4]==1)
$html .= '<th class="col_'.(++$col).'">'._CELLPHONE.'</td>';
if ($params[5]==1)
$html .= '<th class="col_'.(++$col).'">'._EMAIL.'</td>';
if ($params[6]==1)
$html .= '<th class="col_'.(++$col).'">'._WEBSITE.'</td>';
$html .= '</tr>';
$parent_cats = array();
$cur_parent_id = $category_settings["contact_category_id"];
$prev_category_id = $cur_parent_id;
array_push($parent_cats, $cur_parent_id);
foreach ($childcategories as $childcat)
{
if ($childcat["parent_id"]!=$cur_parent_id and $childcat["parent_id"]==$prev_category_id)
{
$cur_parent_id = $prev_category_id;
array_push($parent_cats, $cur_parent_id);
}
else if ($childcat["parent_id"]!=$cur_parent_id and $childcat["parent_id"]!=$prev_category_id)
{
$cur_parent_id = array_pop($parent_cats);
while ($childcat["parent_id"]!=$cur_parent_id and !empty($parent_cats) and count($parent_cats)>0)
{
$cur_parent_id = array_pop($parent_cats);
}
array_push($parent_cats, $cur_parent_id);
}
$level = count($parent_cats)-1;
$prev_category_id = $childcat["id"];
$html .= '<tr class="level_'.$level.'"><td colspan="'.$colspan.'">'.$childcat["title"].'</td></tr>';
$contacts_array = $contacts->getCategoryContactsTranslated($childcat["id"]);
if (!empty($contacts_array) and count($contacts_array)>0)
{
foreach ($contacts_array as $contact)
{
$html .= '<tr class="level_'.$level.' data_row">';
$col = 0;
if ($params[0]==1)
$html .= '<td class="col_'.(++$col).'">'.$contact["title"].'</td>';
if ($params[1]==1)
$html .= '<td class="col_'.(++$col).'">'.$contact["address"].'</td>';
if ($params[2]==1)
$html .= '<td class="col_'.(++$col).'">'.$contact["tel"].'</td>';
if ($params[3]==1)
$html .= '<td class="col_'.(++$col).'">'.$contact["fax"].'</td>';
if ($params[4]==1)
$html .= '<td class="col_'.(++$col).'">'.$contact["cellphone"].'</td>';
if ($params[5]==1)
$html .= '<td class="col_'.(++$col).'">'.$contact["email"].'</td>';
if ($params[6]==1)
$html .= '<td class="col_'.(++$col).'">'.$contact["website"].'</td>';
if ($params[7]==1)
$html .= '<td class="col_'.(++$col).'">'.$contact["extra_info"].'</td>';
$html .= '</tr>';
}
}
}
$html .= '</table>';
$contents_array["title"][0] = $category_settings["title"];
$contents_array["body"][0] = $html;
$contents_per_page = 1;
}
else if ($category_settings["menu_type"]==101) // Αρχείο άρθρων
{
if (preg_match("/^\d\d\d\d-[0-1]\d-[0-3]\d$/", $date))
$date_title = $system->formatDateTextual($date, "d F Y");
else
$date_title = $system->formatDateTextual($date, "F Y");
if ($action="calendar") // Αν η σελίδα αρχείου προήλθε από κλικ στο ένθεμα ημερολόγιο πάρε τις κατηγορίες του ενθέματος
{
$categories->category_settings["title"] .= " ".$date_title;
// Αν έχει δωθεί σωστή λίστα κατηγοριών χωρισμένων με κόμμα βάλε τα ids σε έναν πίνακα αλλιώς άσε τον πίνακα κενό
// ώστε να παρθούν άρθρα απ' όλες τις κατηγορίες
if (preg_match("/^[0-9]+(,[0-9]+)*$/", $category_ids))
$cat_ids = explode(",",$category_ids);
else
$cat_ids = array();
}
else
{
$cat_ids = explode(",",$category_settings["multiple_cat_ids"]);
}
$criteria = "created LIKE '".$date."%'";
if (!empty($cat_ids) and count($cat_ids)>0)
{
$criteria .= " and (".$system->buildCriteria($cat_ids, "category_id").")";
}
$sort_order = "ORDER BY created DESC, id DESC";
if ($_SESSION["perm_frontend_view_registered_content"]==0)
$access_level = "and access=0";
$sql = "SELECT * FROM content WHERE article_type=0 and $criteria $access_level $sort_order LIMIT $start,".$category_settings["articles_per_page"];
$sql = $translator->fixSqlStatement($sql, $translator->current_lang["id"], "content", $general_settings["untranslated_articles_policy"]);
$contents_array = $content->getContents($sql);
$total_contents = $content->total_contents;
$contents_per_page = $content->contents_per_page;
}
else if ($category_settings["menu_type"]==102) // Newsletter registration
{
if ($action=="newsletter_register_submit")
{
$newsletter_registration_error = "";
if (($name_required=="1" and !$validator->validateGeneral($name)) or !$validator->validateGeneral($email))
$newsletter_registration_error = '<p class="error">'._FILL_ALL_FIELDS.'.</p>';
else if (!$validator->validateEmail($email))
$newsletter_registration_error = '<p class="error">'._GIVE_VALID_EMAIL.'.</p>';
else if ($newsletter->emailExists($email))
$newsletter_registration_error = '<p class="error">'._SUBSCRIBER_EMAIL_EXISTS.'.</p>';
if ($newsletter_registration_error=="" and $_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id Αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας)
{
$activation_code = SystemComponent::genRandomString(32);
$result = $newsletter->insertSubscriber($name, $email, $_SERVER['REMOTE_ADDR'], $activation_code, $general_settings["newsletter_require_confirmation"]);
if ($general_settings["newsletter_require_confirmation"]==0)
{
$html = '<p>'._NEWSLETTER_REGISTRATION_COMPLETED.'</p>';
}
else
{
$subject = sprintf(_NEWSLETTER_REGISTRATION_EMAIL_SUBJECT, $general_settings["site_url"]);
$bodymessage = "<html><body>".sprintf(_NEWSLETTER_REGISTRATION_EMAIL_BODY, $name, $general_settings["site_url"], $system->fullURL(), $activation_code, $system->fullURL(), $activation_code)."</body></html>";
$sentstatus = $system->sendEmail($email, $subject, $bodymessage, $general_settings["owner_email"], $general_settings["owner_name"]);
$html = '<p>'._NEWSLETTER_REGISTRATION_COMPLETE_ACTIVATE.'</p>';
}
$_SESSION["prev_form_id"] = $form_id;
}
else
{
$html = $newsletter_registration_error;
$html .= '<p><a href="index.php" onclick="history.go(-1);">« Επιστροφή</a></p>';
}
}
else if ($action=="subscriber_activation")
{
if ($newsletter->activateSubscriber($activation_code))
$html = '<p class="success">'._SUBSCRIBER_ACTIVATION_SUCCESS.'!</p>';
else
$html = '<p class="error">'._SUBSCRIBER_ACTIVATION_ERROR.'.</p>';
}
else if ($action=="unsubscribe")
{
if ($newsletter->getSubscriberById($subscriber_id))
{
$result = $newsletter->deleteSubscriber($subscriber_id);
if ($result==true)
$html = '<p class="success">'._UNSUBSCRIBED_SUCCESSFULLY.'!</p>';
}
}
$contents_array["title"][0] = $category_settings["title"];
$contents_array["body"][0] = $html;
$contents_per_page = 1;
}
else if ($category_settings["menu_type"]==103) // Άρθρα με συγκεκριμένο tag
{
if ($tag!="")
{
$categories->category_settings["title"] = $tag;
$sort_order = "ORDER BY created DESC, id DESC";
if ($_SESSION["perm_frontend_view_registered_content"]==0)
$access_level = "and access=0";
$sql = "SELECT content.* FROM content, tags_content, tags WHERE content.id=tags_content.content_id and tags_content.tag_id=tags.id and tags.name='$tag' and article_type=0 $access_level $sort_order LIMIT $start,".$category_settings["articles_per_page"];
$sql = $translator->fixSqlStatement($sql, $translator->current_lang["id"], "content", $general_settings["untranslated_articles_policy"]);
$contents_array = $content->getContents($sql);
$total_contents = $content->total_contents;
$contents_per_page = $content->contents_per_page;
}
}
$cat_path = $categories->buildCategoryPath($category_settings["id"], $translator->current_lang["id"]); // Αποθηκεύει στον πίνακα $cat_path = array('id' => array(), 'title' => array()); το πλήρες path (από το root μέχρι την τελική) της δοσμένης κατηγορίας
if ($id!=0 or isset($action))
$head_title = $general_settings["site_title"]." - ".$contents_array["title"][0];
else
$head_title = $general_settings["site_title"]." - ".$cat_path["title"][count($cat_path["title"])-1];
$breadcrumb = $categories->buildBreadcrumb($cat_path); // HTML για προβολή του breadcrumb
$main_menu = $categories->buildMenu(0, $cat_path['id']); // Καταχώρησε στη μεταβλητή $main_menu σε HTML όλη τη δομή του κυρίως μενού (ul>li>ul>li κλπ)
$sub_menu = $categories->buildMenu($category_settings["id"]); // Καταχώρησε στη μεταβλητή $sub_menu σε HTML όλη τη δομή του υπομενού της τρέχουσας επιλεγμένης κατηγορίας (ul>li>ul>li κλπ)
$has_subcats = $categories->hasSubCategories(); // Η μεταβλητή $has_subcats είναι true αν η τρέχουσα κατηγορία έχει άλλες υποκατηγορίες
if ($category_settings["menu_type"] != 9) // Όχι φωτογραφικά άλμπουμ
$pagination = $categories->buildPagination($total_contents, $start); // Μεταβλητή που περιέχει τον HTML κώδικα του μενού της σελιδοποίησης για τις κατηγορίες με πολλά άρθρα
// Μεταβλητή που περιέχει όλα τις πληροφορίες του header των meta tags
$header_data = '<meta charset="utf-8" />'.PHP_EOL;
$header_data .= '<title>'.$head_title.'</title>'.PHP_EOL;
$header_data .= '<meta name="description" content="'.$general_settings["meta_description"].'" />'.PHP_EOL;
$header_data .= '<meta name="keywords" content="'.$general_settings["meta_keywords"].'" />'.PHP_EOL;
if ($category_settings["show_rss_link"]==1)
$header_data .= '<link href="index.php?action=feed&feed=rss2&cat_ids='.$category_settings["id"].'&lang='.$lang.'" rel="alternate" type="application/rss+xml" title="RSS 2.0" />'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="js/jquery.min.js"></script>'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="js/jquery-ui.min.js"></script>'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="js/jquery.ui.datepicker-el.js"></script>'.PHP_EOL;
$header_data .= '<link rel="stylesheet" type="text/css" href="js/jquery-ui/css/smoothness/jquery-ui.custom.css" />'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="js/jquery.bgpos.js"></script>'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="js/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="js/fancybox/source/jquery.fancybox.pack.js?v=2.0.5"></script>'.PHP_EOL;
$header_data .= '<link rel="stylesheet" href="js/fancybox/source/jquery.fancybox.css?v=2.0.5" type="text/css" media="screen" />'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="js/hint.js"></script>'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="players/jwplayer.js"></script>'.PHP_EOL;
$header_data .= '<!--[if lt IE 7]><script type="text/javascript" src="js/unitpngfix/unitpngfix.js"></script><![endif]-->'.PHP_EOL;
$header_data .= '<script type="text/javascript" src="js/core.js"></script>'.PHP_EOL;
// Πίνακας με τα module types όλων των modules (mod_custom, mod_search, mod_latestnews κλπ). Χρησιμοποιείται για το ορισμό του ονόματος της css κλάσης του κάθε module
$mod_types_array = $modules->getModuleTypesArray();
$google_maps_counter = 0; // Το πλήθος των Google Map ενθεμάτων που υπάρχουν ταυτόχρονα στη σελίδα
$sliders_counter = 0; // Το πλήθος των slider ενθεμάτων που υπάρχουν ταυτόχρονα στη σελίδα
// Ενσωμάτωση των ενθεμάτων στο σώμα των άρθρων στα οποία ορίστηκαν ενσωματωμένα ενθέματα με την εντολή {module id}
$cc = (!empty($contents_array["body"])?count($contents_array["body"]):0);
for ($i=0; $i<$cc; ++$i)
{
if (preg_match_all('/{\s*module\s+[\d]+\s*}/', $contents_array["body"][$i], $matches, PREG_PATTERN_ORDER)>0);
{
foreach ($matches[0] as $match)
{
preg_match('/\d+/', $match, $out);
$module_id = $out[0];
// Αν υπάρχει το ένθεμα με το συγκεκριμένο id αντικατέστησε την εντολή {module id} με το περιεχόμενο (σώμα) του ενθέματος, διαφορετικά αντικατέστησέ το με το κενό
if ($embedded_module = $modules->getModuleById($module_id))
{
$module_html = buildModuleHtml($embedded_module);
$module_body = str_replace('<div class="clear"></div></div></div>', '', substr($module_html, stripos($module_html, '<div class="module_body">')+25));
$contents_array["body"][$i] = str_replace($match, $module_body, $contents_array["body"][$i]);
}
else
{
$contents_array["body"][$i] = str_replace($match, "", $contents_array["body"][$i]);
}
}
}
}
// --------------------------------------------------------------------------------------------------------------
// Δημιουργία και αποθήκευση στη μεταβλητή $main_content του κυρίως περιεχομένου της κάθε σελίδας
// --------------------------------------------------------------------------------------------------------------
$html = "";
if ($categories->category_settings["menu_type"]==4) // Λίστα συνδέσμων
{
$html .= '<h3 class="linkstitle">'.$categories->category_settings['title'].'</h3>';
if ($categories->category_settings["description"]!="")
$html .= '<div id="category_description">'.nl2br($categories->category_settings["description"]).'</div>';
for ($i=0; $i<$contents_per_page; ++$i)
{
if ($contents_array["link_target"][$i]==1)
$target = ' target="_blank"';
else
$target = '';
$html .= '<div class="linktitle"><a href="index.php?weblink='.$contents_array["id"][$i].'"'.$target.'>'.$contents_array["title"][$i].'</a></div>';
$html .= '<div class="linkbody">'.nl2br($contents_array["body"][$i]).'</div>';
}
}
else if ($categories->category_settings["articles_layout"]=="list" and $contents_per_page>1) // Λίστα άρθρων
{
if ($listordertype=="ASC")
$listordertype="DESC";
else
$listordertype="ASC";
$html .= '<div class="article">';
$html .= '<div class="article_title"><h3>'.$categories->category_settings["title"].'</h3></div>';
$html .= '<div class="article_body">';
if ($categories->category_settings["description"]!="")
$html .= '<div id="category_description">'.nl2br($categories->category_settings["description"]).'</div>';
if ($contents_per_page>0)
{
$html .= '<div id="articles_list">';
$html .= '<table><thead><tr><th class="listtitle"><a href="index.php?cat_id='.$categories->category_settings["id"].'&start='.$start.'&listordering=title&listordertype='.$listordertype.'" title="'._SORT_BY_TITLE.'">'._TITLE.'</a>';
if ($listordering=="title" and $listordertype=="ASC")
$html .= ' <img src="images/core/sort_asc.png" />';
else if ($listordering=="title" and $listordertype=="DESC")
$html .= ' <img src="images/core/sort_desc.png" />';
$html .= '</th>';
if ($categories->category_settings["list_show_date"]==1)
{
$html .= '<th class="listdate"><a href="index.php?cat_id='.$categories->category_settings["id"].'&start='.$start.'&listordering=created&listordertype='.$listordertype.'" title="'._SORT_BY_DATE.'">'._DATE.'</a>';
if ($listordering=="created" and $listordertype=="ASC")
$html .= ' <img src="images/core/sort_asc.png" />';
else if ($listordering=="created" and $listordertype=="DESC")
$html .= ' <img src="images/core/sort_desc.png" />';
$html .= '</th>';
}
if ($categories->category_settings["list_show_author"]==1)
{
$html .= '<th class="listauthor"><a href="index.php?cat_id='.$categories->category_settings["id"].'&start='.$start.'&listordering=userid&listordertype='.$listordertype.'" title="'._SORT_BY_AUTHOR.'">'._AUTHOR.'</a>';
if ($listordering=="userid" and $listordertype=="ASC")
$html .= ' <img src="images/core/sort_asc.png" />';
else if ($listordering=="userid" and $listordertype=="DESC")
$html .= ' <img src="images/core/sort_desc.png" />';
$html .= '</th>';
}
$html .= '</tr></thead><tbody>';
}
for ($i=0; $i<$contents_per_page; ++$i)
{
$html .= '<tr class="listrow_'.($i%2).'"><td class="listtitle"><a href="index.php?cat_id='.$contents_array["category_id"][$i].'&id='.$contents_array["id"][$i].'">'.$contents_array["title"][$i].'</a></td>';
if ($categories->category_settings["list_show_date"]==1)
$html .= '<td class="listdate">'.$system->formatDateTextual($contents_array["created"][$i], "d M Y").'</td>';
if ($categories->category_settings["list_show_author"]==1)
$html .= '<td class="listauthor">'.$contents_array["author"][$i].'</td>';
$html .= '</tr>';
}
if ($contents_per_page>0)
$html .= '</tbody></table>';
$html .= '</div></div></div>';
}
else // Άρθρα σε μορφή blog
{
for ($i=0; $i<$contents_per_page; ++$i)
{
if (!empty($contents_array["title"]) and count($contents_array["title"])>1)
{
if ($i==0)
{
if ($categories->category_settings["description"]!="")
$html .= '<div id="category_description">'.nl2br($categories->category_settings["description"]).'</div>';
$html .= '<table id="blog_table">';
}
if ($i<$categories->category_settings["blog_head_articles"])
$html .= '<tr>';
else if (($i-$categories->category_settings["blog_head_articles"])%$categories->category_settings["blog_article_rows"] == 0)
$html .= '<tr>';
if ($i<$categories->category_settings["blog_head_articles"])
$html .= '<td width="100%" colspan="'.$categories->category_settings["blog_article_rows"].'">';
else
$html .= '<td width="'.(100/$categories->category_settings["blog_article_rows"]).'%">';
$html .= '<div class="article">';
$html .= '<div class="article_title"><h3>'.$contents_array["title"][$i].'</h3></div>';
if ($contents_array["metadata"][$i]!="")
$html .= '<div class="article_meta">'.$contents_array["metadata"][$i].'</div>';
$html .= '<div class="article_body">'.$contents_array["body_preview"][$i].'</div>';
// Ετικέτες άρθρου
if (!empty($contents_array["id"][$i]))
{
$tags_array = $tags->getTagsByContentId($contents_array["id"][$i]);
if (!empty($tags_array) and count($tags_array)>0)
{
$html .= '<div class="article_tags">'._TAGS.': ';
$c = 0;
foreach ($tags_array as $tag)
{
if ($c>0)
$html .= ', ';
$html .= '<a href="index.php?action=searchtags&tag='. $tag["name"].'">'. $tag["name"].'</a>';
++$c;
}
$html .= '</div>';
}
}
$html .= '<div class="readmore"><a href="index.php?cat_id='.$categories->category_settings["id"].'&id='.$contents_array["id"][$i].'"><span>'._READ_MORE.'</span></a></div>';
$html .= '</div>';
$html .= '</td>';
if ($i<$categories->category_settings["blog_head_articles"])
$html .= '</tr>';
else if (($i-$categories->category_settings["blog_head_articles"]+1)%$categories->category_settings["blog_article_rows"] == 0)
$html .= '</tr>';
}
else // Προβολή ολόκληρου άρθρου
{
$html .= '<div class="article">';
$html .= '<div class="article_title"><h3>'.$contents_array["title"][$i].'</h3></div>';
if ($contents_array["metadata"][$i]!="")
$html .= '<div class="article_meta">'.$contents_array["metadata"][$i].'</div>';
if ($contents_array["show_pdf_icon"][$i]!=0 or $contents_array["show_print_icon"][$i]!=0 or $contents_array["show_email_icon"][$i]!=0)
{
$html .= '<div class="article_actions"><ul class="actions">';
if ($contents_array["show_pdf_icon"][$i]!=0)
{
$html .= '<li class="pdf_icon">';
$html .= '<a href="'.$system->fullURL().'&makepdf=1" title="PDF">';
$html .= '<img alt="PDF" src="images/core/button_pdf.png">';
$html .= '</a></li>';
}
if ($contents_array["show_print_icon"][$i]!=0)
{
$html .= '<li class="print_icon">';
$html .= '<a href="'.$system->fullURL().'" title="'._PRINT.'">';
$html .= '<img alt="'._PRINT.'" src="images/core/button_print.png">';
$html .= '</a></li>';
}
if ($contents_array["show_email_icon"][$i]!=0)
{
$html .= '<li class="email_icon">';
$html .= '<a href="" title="'._SEND_BY_EMAIL.'">';
$html .= '<img alt="'._SEND_BY_EMAIL.'" src="images/core/button_email.png">';
$html .= '</a></li>';
}
$html .= '</ul></div>';
}
$html .= '<div class="clear"></div>';
if ($categories->category_settings["description"]!="")
$html .= '<div id="category_description">'.nl2br($categories->category_settings["description"]).'</div>';
$html .= '<div class="article_body">'.$contents_array["body"][$i];
if (!empty($contents_array["attachments"][$i]) and count($contents_array["attachments"][$i])>0)
{
$html .= '<div id="attachments"><h4>'._ATTACHMENTS.':</h4><ul>';
$html .= '<li id="at_header"><span class="at_filename">'._FILE.'</span><span class="at_filesize">'._SIZE.'</span></li>';
for ($j=0; $j<count($contents_array["attachments"][$i]); ++$j)
{
if ($contents_array["attachments"][$i][$j]["display_name"]!="")
$display_name = $contents_array["attachments"][$i][$j]["display_name"];
else
$display_name = $contents_array["attachments"][$i][$j]["filename"];
if ($contents_array["attachments"][$i][$j]["description"]!="")
$file_description = $contents_array["attachments"][$i][$j]["description"];
else
$file_description = _DOWNLOAD_FILE." ".$contents_array["attachments"][$i][$j]["filename"];
if ($contents_array["attachments"][$i][$j]["file_size"]==0 or $contents_array["attachments"][$i][$j]["file_size"]==NULL)
$file_size = "-";
else if ($contents_array["attachments"][$i][$j]["file_size"]<1024*1024)
$file_size = round($contents_array["attachments"][$i][$j]["file_size"]/1024)." Kb";
else
$file_size = round($contents_array["attachments"][$i][$j]["file_size"]/(1024*1024))." Mb";
$html .= '<li><span class="at_filename"><a href="'.$contents_array["attachments"][$i][$j]["url"].'" target="_blank" title="'.$file_description.'"><img src="images/core/file_type_'.$contents_array["attachments"][$i][$j]["file_type"].'.gif" />'.$display_name.'</a></span><span class="at_filesize">'.$file_size.'</span></li>';
}
$html .= '</ul></div>';
}
$html .= '</div></div>';
// Ετικέτες άρθρου
if (!empty($contents_array["id"][$i]))
{
$tags_array = $tags->getTagsByContentId($contents_array["id"][$i]);
if (!empty($tags_array) and count($tags_array)>0)
{
$html .= '<div class="article_tags">'._TAGS.': ';
$c = 0;
foreach ($tags_array as $tag)
{
if ($c>0)
$html .= ', ';
$html .= '<a href="index.php?action=searchtags&tag='. $tag["name"].'">'. $tag["name"].'</a>';
++$c;
}
$html .= '</div>';
}
}
// Σχόλια άρθρου
if ($contents_array["show_comments"][$i]==1)
{
$comments_parameters = unserialize($general_settings["comments_parameters"]);
// Πρώτα ελέγχουμε για τυχόν αποστολή νέου σχολίου έτσι ώστε να προβληθεί και το νέο σχόλιο στη σελίδα
if ($action=="comment_submit")
{
$error_class = array();
$error_txt = array();
if ($_SESSION["prev_form_id"] != $form_id) // Το $_SESSION["prev_form_id"] != $form_id Αποτρέπει το resubmit της φόρμας σε περίπτωση reload της σελίδας)
{
if (!$validator->validateGeneral($name))
{
$error_class["name"] = ' class="error_field"';
$error_txt["name"] = '<p class="error_txt">'._FIELD_IS_REQUIRED.'</p>';
}
if (!$validator->validateGeneral($email))
{
$error_class["email"] = ' class="error_field"';
$error_txt["email"] = '<p class="error_txt">'._FIELD_IS_REQUIRED.'</p>';
}
else if (!$validator->validateEmail($email))
{
$error_class["email"] = ' class="error_field"';
$error_txt["email"] = '<p class="error_txt">'._INVALID_EMAIL.'</p>';
}
if (!$validator->validateGeneral($comment))
{
$error_class["comment"] = ' class="error_field"';
$error_txt["comment"] = '<p class="error_txt">'._FIELD_IS_REQUIRED.'</p>';
}
if ($comments_parameters["captcha_protection"]==1)
{
if (!$validator->validateGeneral($captcha))
{
$error_class["captcha"] = ' class="error_field"';
$error_txt["captcha"] = '<p class="error_txt">'._FILL_SECURITY_CODE.'</p>';
}
else
{
if (empty($_SESSION['captcha']) || trim(strtolower($captcha)) != $_SESSION['captcha'])
{
$error_class["captcha"] = ' class="error_field"';
$error_txt["captcha"] = '<p class="error_txt">'._WRONG_SECURITY_CODE.'</p>';
}
}
}
if (!empty($error_class) and count($error_class)==0)
{
if ($comments_parameters["comment_approval"]==1)
{
$state = 0;
$msg = _COMMENT_ADDED_CONFIRMATION_NEEDED;
}
else
{
$state = 1;
$msg = _COMMENT_ADDED_SUCCESFULLY;
}
$result = $comments->insertComment($parent_id, $contents_array["id"][$i], (int) $_SESSION["userid"], $name, $email, $homepage, $system->stripHTMLTags(nl2br(str_replace('\r\n', "\n", $comment)),"<br>"), $_SERVER['REMOTE_ADDR'], date("Y-m-d H:i:s"), $state);
if ($result==true)
{
$infomsg = '<p class="success">'.$msg.'</p>';
}
else
{
$infomsg = '<p class="error">'._COMMENT_SUBMIT_FAILED.'</p>';
}
$comment = "";
$parent_id = 0;
}
$_SESSION["prev_form_id"] = $form_id;
}
}
$comments_array = $comments->getCommentsByContentId($contents_array["id"][$i], "created", $comments_parameters["comments_order"], 1, $comments_parameters["nested_layout"]);
$total_results = (!empty($comments_array)?count($comments_array):0);
if (!empty($comments_array) and count($comments_array)>0)
{
$html .= '<div id="comments">';
$html .= '<h3 id="comments-title">'.count($comments_array).' '._COMMENTS.'</h3>';
$html .= '<ol class="comments_list">';
foreach ($comments_array as $comment_item)
{
if ($comment_item["email"]!="")
$author = '<a href="mailto:'.$comment_item["email"].'">'.$comment_item["name"].'</a>';
else
$author = $comment_item["name"];
$html .= '<li class="comment level_'.$comment_item["depth"].'">';
$html .= '<div class="comment_avatar"><img src="images/core/avatar.png"></div>';
$html .= '<div class="comment_author">'._BY.' <strong>'.$author.'</strong></div>';
$html .= '<div class="comment_date">'.$system->formatDateTextual($comment_item["created"], "l, j F Y G:i").'</div>';
$html .= '<div class="comment_body">'.$comment_item["comment"].'</div>';
if ($comments_parameters["nested_layout"]==1 and $comment_item["depth"]<($comments_parameters["nested_comments_depth"]-1) and ($comments_parameters["only_registered_post"]==0 or ($comments_parameters["only_registered_post"]==1) and isset($_SESSION["userid"])))
{
$html .= '<div class="comment_footer"><a class="comment_reply" href="#comments_post" data-replyto="'.$comment_item["id"].'" data-replytoauthor="'.$comment_item["name"].'">'._REPLY.' <span>↓</span></a></div>';
}
$html .= '</li>';
}
$html .= '</ol></div>';
}
if ($comments_parameters["only_registered_post"]==0 or ($comments_parameters["only_registered_post"]==1) and isset($_SESSION["userid"]))
{
if (!empty($parent_id) and !empty($error_class) and count($error_class)>0)
{
$parent_comment = $comments->getCommentById($parent_id);
$parent_comment_name = $parent_comment["name"];
}
$html .= '<div id="comments_post">';
$html .= '<h3>'._LEAVE_COMMENT.'</h3>';
$html .= $infomsg;
$html .= '<div id="replyto"'.((empty($parent_id) or count($error_class)==0)?' class="hide"':'').'>'._REPLY_TO.': <strong>'.$parent_comment_name.'</strong><a id="replyto_cancel" href="index.php">'._CANCEL_REPLY.'</a></div>';
$html .= '<form id="comments_form" method="post" action="'.$system->fullURL().'#comments_post">';
$html .= '<input type="hidden" name="action" value="comment_submit" />';
$html .= '<input type="hidden" name="form_id" value="'.$system->genRandomString().'" />';
$html .= '<input type="hidden" name="parent_id" id="parent_id" value="'.(int) $parent_id.'" />';
if (isset($_SESSION["userid"]))
{
$html .= '<input type="hidden" name="name" id="name" value="'.$_SESSION["fullname"].'" />';
$html .= '<input type="hidden" name="email" id="email" value="'.$_SESSION["email"].'" />';
$html .= '<input type="hidden" name="homepage" id="homepage" value="'.$_SESSION["website"].'" />';
}
else
{
$html .= '<div><label for="name">'._ΝΑΜΕ.' *</label><input type="text" name="name" id="name" value="'.$name.'"'.$error_class["name"].' />'.$error_txt["name"].'</div>';
$html .= '<div><label for="email">'._EMAIL.' *</label><input type="text" name="email" id="email" value="'.$email.'"'.$error_class["email"].' />'.$error_txt["email"].'</div>';
$html .= '<div><label for="homepage">'._SITE_BLOG_FACEBOOK.'</label><input type="text" name="homepage" id="homepage" value="'.$homepage.'" /></div>';
}
$html .= '<div><label for="comment">'._COMMENT.' *</label><textarea id="comment" name="comment" maxlength="'.$comments_parameters["comment_max_length"].'"'.$error_class["comment"].'>'.$comment.'</textarea>';
$html .= '<p class="chars_left"><strong>'.$comments_parameters["comment_max_length"].'</strong> '._CHARACTERS_LEFT.'</p>'.$error_txt["comment"];
$html .= '<p class="form_required">* '._REQUIRED_FIELDS.'</p></div>';
if ($comments_parameters["captcha_protection"]==1)
{
$html .= '<div><img src="includes/coolPHPCaptcha/captcha.php" id="captcha" />';
$html .= '<a href="#" onclick="document.getElementById(\'captcha\').src=\'includes/coolPHPCaptcha/captcha.php?\'+Math.random(); document.getElementById(\'captcha_field\').focus(); return false;" id="change-image" title="Change text"><img src="images/core/icon_refresh.png" alt="Change text"></a><br/>';
$html .= '<input type="text" name="captcha" id="captcha_field" autocomplete="off"'.$error_class["captcha"].' />'.$error_txt["captcha"].'</div>';
}
$html .= '<div><input type="submit" name="submit" value="'._SEND.'" /></div>';
$html .= '</form></div>';
}
}
if ($contents_array["show_email_icon"][$i]!=0)
{
$html .= '<div class="hide">';
$html .= '<div id="article_mailto">';
$html .= '<h4>Στείλτε αυτόν τον σύνδεσμο σε έναν φίλο:</h4>';
$html .= '<form action="index.php" name="article_mailto_form" id="article_mailto_form" method="post">';
$html .= '<input type="hidden" name="form_id" value="'.$system->genRandomString().'" />';
$html .= '<input type="hidden" name="url" value="'.$system->fullURL().'" />';
$html .= '<p><label>Αποστολή προς:</label><input type="text" class="required email" name="recipient_email" /></p>';
$html .= '<p><label>Το όνομά σας:</label><input type="text" class="required" name="sender_name" /></p>';
$html .= '<p><label>Το email σας:</label><input type="text" class="required email" name="sender_email" /></p>';
$html .= '<p><label>Θέμα:</label><input type="text" class="required" name="email_subject" value="'.$head_title.'" /><input type="text" name="myfield" id="myfield" /></p>';
$html .= '<p class="actions"><input type="submit" name="article_mailto_send" class="article_mailto_send" value="Αποστολή"><input type="button" name="article_mailto_cancel" class="article_mailto_cancel" value="Aκύρωση"></p>';
$html .= '<p class="notice">* Όλα τα πεδία είναι υποχρεωτικά</p>';
$html .= '</div></div>';
}
}
}
if (!empty($contents_array["title"]) and count($contents_array["title"])>1)
$html .= '</table>';
}
if ($pagination!="")
$html .= '<div class="pagination">'.$pagination.'</div>';
if ($contents_per_page>0 and $categories->category_settings["show_submenu"]==1 and $has_subcats==true and !in_array($categories->category_settings["menu_type"], array(0,7)))
$html .= '<div class="article sub_menus"><div class="article_body"><p>'.$sub_menu.'</p></div></div>';
else if ($contents_per_page==0)
{
$html .= '<div class="article sub_menus">';
$html .= '<div class="article_title"><h3>'.$categories->category_settings["title"].'</h3></div>';
$html .= '<div class="article_body">';
if ($categories->category_settings["menu_type"]!=4 and $categories->category_settings["description"]!="")
$html .= '<div id="category_description">'.nl2br($categories->category_settings["description"]).'</div>';
if ($has_subcats==true)
$html .= '<p>'._CHOOSE_SUBCATEGORY.':'.$sub_menu.'</p>';
else
$html .= '<p class="info">'._NO_CONTENT_IN_CATEGORY.'...</p>';
$html .= '</div></div>';
}
$main_content = $html;
// --------------------------------------------------------------------------------------------------------------
// /Δημιουργία υπό μορφή πίνακα (ένα module ανά κελί πίνακα) του HTML κώδικα των modules
// --------------------------------------------------------------------------------------------------------------
$mod_positions_array = $modules->getModulePositionsArray(); // Πίνακας με τις ενεργές θέσεις των Modules
foreach ($mod_positions_array as $mod_position)
{
$modules_per_position_array = $modules->getModulesPerPositionArray($mod_position["id"], $category_settings["id"]); // Πίνακας με τα ενεργά Modules της συγκεκριμένης δοσμένης θέσης και δοσμένης κατηγορίας
foreach ($modules_per_position_array as $module)
{
$temp = buildModuleHtml($module);
$modules_array[$mod_position["position"]][] = $temp;
}
}
$modules = $modules_array;
// Δημιουργεί τον html κώδικα του δοσμένου $module
function buildModuleHtml($module, $extra_classes="")
{
global $general_settings, $lang, $locale, $content, $modules, $system, $categories, $translator, $galleries, $mod_types_array, $breadcrumb, $category_settings, $cat_path, $date, $header_data, $google_maps_counter, $sliders_counter;
// Διάβασε τις παραμέτρους των modules στις αντιστοίχου ονόματος μεταβλητές
$module_parameters_array = $modules->getModuleParametersArray($module);
$module_class = "module ".$mod_types_array[$module["mod_type"]]["mod_type"];
if ($module["classname"]!="")
$module_class .= " ".$module["classname"];
if ($extra_classes!="")
$module_class .= " ".$extra_classes;
$temp = '<div class="'.$module_class.'">';
if ($module["title"]!="" and $module["show_title"]==1)
{
$temp .= '<div class="module_title"><h3>'.$module["title"];
if ($module_parameters_array["param_show_rss_icon"]=="1")
$temp .= '<a href="index.php?action=feed&feed=rss2&cat_ids='.$module_parameters_array["param_category_ids"].'&lang='.$translator->current_lang["code"].'" title="RSS Feed"><img src="images/core/rss2.png" alt="RSS Feed" /></a>';
$temp .= '</h3></div>';
}
$temp .= '<div class="module_body">';
if ($module["mod_type"]==1) // Περιεχόμενο HTML
{
$temp .= $module["body"];
}
else if ($module["mod_type"]==2) // Φόρμα αναζήτησης
{
if ($module["params"]!="")
{
$params_array = explode("\n", $module["params"]);
foreach($params_array as $param_entry)
{
$param_array = explode("=",$param_entry);
${$param_array[0]} = $param_array[1];
}
}
$param_extra_search_fields = substr($module["params"], (strpos($module["params"],"param_extra_search_fields=")+26));
$temp .= '<form method="post" action="index.php">';
if ($module["body"]!="" and $param_search_text_position=="top")
$temp .= '<p>'.$module["body"].'</p>';
$temp .= '<fieldset class="query_input">';
$temp .= '<input type="hidden" name="action" value="search" />';
$temp .= '<input type="text" name="query" title="'._SEARCH.'..." />';
$temp .= '<input type="image" src="images/core/magnifier.png" title="Αναζήτηση" />';
$temp .= '</fieldset>';
if ($param_search_in_contacts=="1" or $param_search_in_catalogue=="1")
{
$temp .= '<fieldset class="search_parameters">';
$temp .= '<input type="radio" name="search_in" value="website" id="search_in_website" checked="checked">';
$temp .= '<label for="search_in_website"><img src="images/core/btn_globe.jpg" alt="'._SEARCH_IN_WEBSITE.'" title="'._SEARCH_IN_WEBSITE.'" /><span>'._SEARCH_IN_WEBSITE.'</span></label>';
if ($param_search_in_contacts=="1")
{
$temp .= '<input type="radio" name="search_in" value="contacts" id="search_in_phonebook">';
$temp .= '<label for="search_in_phonebook"><img src="images/core/btn_phonebook.jpg" alt="'._SEARCH_IN_CONTACTS.'" title="'._SEARCH_IN_CONTACTS.'" /><span>'._SEARCH_IN_CONTACTS.'</span></label>';
}
if ($param_search_in_catalogue=="1")
{
$temp .= '<input type="radio" name="search_in" value="catalogue" id="search_in_catalogue">';
$temp .= '<label for="search_in_catalogue"><img src="images/core/btn_contactcard.jpg" alt="'._SEARCH_IN_CATALOGUE.'" title="'._SEARCH_IN_CATALOGUE.'" /><span>'._SEARCH_IN_CATALOGUE.'</span></label>';
}
$temp .= '</fieldset>';
}
if ($module["body"]!="" and $param_search_text_position=="bottom")
$temp .= '<p>'.$module["body"].'</p>';
$temp .= '</form>';
}
else if ($module["mod_type"]==3 or $module["mod_type"]==10) // Τελευταία νέα ή Δημοφιλή νέα
{
$news_array = array();
$news_array = $modules->getLatestPopularNews($module["mod_type"], $module_parameters_array);
if (!empty($news_array) and count($news_array)>0)
{
$c = 0;
foreach ($news_array as $news_item)
{
if ($c==0)
$temp .= '<ul>';
$temp .= '<li'.($c%2==0?' class="odd"':' class="even"').'><span>'.$system->formatDateTextual($news_item["created"], $module_parameters_array["param_date_format"]).'</span><a href="index.php?id='.$news_item["id"].'">'.$news_item["title"].'</a></li>';
++$c;
}
$temp .= '</ul>';
if ($module_parameters_array["param_show_morenews"]=="1")
{
if ($module_parameters_array["param_show_morenews_text"]!="")
$readmore_text = $module_parameters_array["param_show_morenews_text"];
else
$readmore_text = _READ_MORE;
$catids_array = explode(",", $module_parameters_array["param_category_ids"]);
$temp .= '<div class="readmore"><a href="index.php?cat_id='.$catids_array[0].'"><span>'.$readmore_text.'</span></a></div>';
}
}
else
{
if ($module_parameters_array["param_hide_when_empty"]=="1")
{
return;
}
else
{
$temp .= '<ul><li>'._NO_NEWS.'...</li></ul>';
}
}
}
else if ($module["mod_type"]==4) // Breadcrumb
{
$temp .= $breadcrumb;
}
else if ($module["mod_type"]==5) // Ροή RSS
{
$temp .= '<a href="index.php?action=feed&feed=rss2&cat_ids='.$category_settings["id"].'&lang='.$translator->current_lang["code"].'" title="'.$module["body"].'"><img src="images/core/rss.png" alt="'.$module["body"].'" /> '.$module["body"].'</a>';
}
else if ($module["mod_type"]==6) // Στοιχεία επικοινωνίας
{
$param_contact_array = $modules->getContactParametersArray($module_parameters_array);
$full_adress = $general_settings["owner_city"].(($general_settings["owner_city"]!="" and $general_settings["owner_country"]!="")?", ":"").$general_settings["owner_country"].($general_settings["owner_zipcode"]!=""?" - ":"").$general_settings["owner_zipcode"];
if ($general_settings["owner_name"]!="" and $param_contact_array[0]==1)
$temp .= '<h4>'.$general_settings["owner_name"].'</h4>';
$temp .= '<ul class="contact_info">';
if ($general_settings["owner_address"]!="" and $param_contact_array[1]==1)
{
$temp .= '<li class="contact_info_title contact_address">';
if ($general_settings["owner_address"]!="")
$temp .= $general_settings["owner_address"];
if ($full_adress!="")
$temp .= '<br />'.$full_adress;
$temp .= '</li>';
}
if ($general_settings["owner_tel"]!="" and $param_contact_array[2]==1)
$temp .= '<li class="contact_info_title contact_telephone">'.$general_settings["owner_tel"].'</li>';
if ($general_settings["owner_fax"]!="" and $param_contact_array[3]==1)
$temp .= '<li class="contact_info_title contact_fax">'.$general_settings["owner_fax"].'</li>';
if ($general_settings["owner_cellphone"]!="" and $param_contact_array[4]==1)
$temp .= '<li class="contact_info_title contact_cellphone">'.$general_settings["owner_cellphone"].'</li>';
if ($general_settings["owner_email"]!="" and $param_contact_array[5]==1)
$temp .= '<li class="contact_info_title contact_email"><a href="mailto:'.$general_settings["owner_email"].'">'.$general_settings["owner_email"].'</a></li>';
if ($general_settings["site_url"]!="" and $param_contact_array[6]==1)
$temp .= '<li class="contact_info_title contact_url"><a href="'.$general_settings["site_url"].'">'.$general_settings["site_url"].'</a></li>';
$temp .= '</ul><div class="clear"></div>';
}
else if ($module["mod_type"]==7) // Δευτερεύον μενού
{
$categories_array = $modules->getSecontaryMenuCategoriesArray($module_parameters_array); // Πίνακας με τις κατηγορίες του δευτερεύοντος μενού
$i=0;
foreach ($categories_array as $category)
{
if ($i==0)
$temp .= '<ul>';
if ($category["menu_type"]==3)
{
if ($category["external_link"]=="" or $category["external_link"]=="http://")
$anchor_params = ' href="javascript:;"';
else
{
$anchor_params = ' href="'.$category["external_link"].'"';
if (strstr($category["external_link"],"http://"))
$anchor_params .= ' target="_blank"';
}
}
else
$anchor_params = ' href="index.php?cat_id='.$category["id"].'"';
$temp .= '<li class="menu_item_'.($i+1).'"><a'.$anchor_params.'>'.$category["title"].'</a></li>';
++$i;
}
if ($i>0)
$temp .= '</ul>';
}
else if ($module["mod_type"]==8) // Επιλογή γλώσσας
{
$url_params = $system->removeUrlParam("lang");
if ($module_parameters_array["param_language_label"]==1)
$temp .= _LANGUAGE.': ';
else if ($module_parameters_array["param_language_label"]==2)
$temp .= _LANGUAGE.':<br />';
$languages_array = $translator->getActiveLanguagesArray();
if ($module_parameters_array["param_language_style"]==1)
{
foreach ($languages_array as $language)
{
if ($translator->current_lang["code"]==$language["code"])
$class = ' class="curlang"';
else
$class = '';
$temp .= '<a href="index.php?lang='.$language["code"].($url_params!=""?"&":"").$url_params.'" title="'.$language["name"].'"'.$class.'><img src="'.$language["path"].'/flag.gif" /></a>';
}
}
else if ($module_parameters_array["param_language_style"]==2)
{
foreach ($languages_array as $language)
{
if ($translator->current_lang["code"]==$language["code"])
$class = ' class="curlang"';
else
$class = '';
$temp .= '<a href="index.php?lang='.$language["code"].($url_params!=""?"&":"").$url_params.'" title="'.$language["name"].'"'.$class.'>'.$language["name"].'</a>';
}
}
else
{
$temp .= '<form method="get" name="frmLanguage" action="index.php">';
$temp .= '<input type="hidden" name="cat_id" value="'.$category_settings["id"].'" />';
$temp .= '<input type="hidden" name="id" value="'.$id.'" />';
$temp .= '<select name="lang" title="'._LANGUAGE.'" onchange="frmLanguage.submit();">';
foreach ($languages_array as $language)
{
if ($translator->current_lang["code"]==$language["code"])
$class = ' selected="selected"';
else
$class = '';
$temp .= '<option value="'.$language["code"].'"'.$class.'>'.$language["name"].'</option>';
}
$temp .= '</select></form>';
}
}
else if ($module["mod_type"]==9) // Login form
{
if (isset($_SESSION["userid"]))
{
if ($module_parameters_array["param_show_greeting"]=="1")
{
if ($module_parameters_array["param_greeting_username"]=="0")
$user_address = $_SESSION["username"];
else
$user_address = $_SESSION["fullname"];
$temp .= '<p>'._USER_GREETING.', <strong>'.$user_address.'</strong></p>';
}
$temp .= '<ul><li><a href="index.php?action=myaccount">'._USER_MYACCOUNT.'</a></li>';
$temp .= '<li><a href="index.php?action=logout">'._LOGOUT.'</a></li></ul>';
}
else
{
if ($module_parameters_array["param_text_position"]=="top" and $module["body"]!="")
$temp .= '<p>'.nl2br($module["body"]).'</p>';
$temp .= '<form method="post" action="index.php">';
$temp .= '<input type="hidden" name="action" value="login_submit" />';
$temp .= '<div><label for="username">'._USERNAME.'</label><input type="text" name="username" id="username"></div>';
$temp .= '<div><label for="password">'._PASSWORD.'</label><input type="password" name="password" id="password"></div>';
$temp .= '<div><input type="submit" name="submit" value="'._LOGIN.'" /></div>';
$temp .= '</form><ul>';
$temp .= '<li><a href="index.php?action=lost_password_request">'._LOST_PASSWORD_QUESTION.'</a></li>';
if ($general_settings["user_allow_registration"]==1)
$temp .= '<li><a href="index.php?action=register">'._CREATE_ACCOUNT.'</a></li>';
$temp .= '</ul>';
if ($module_parameters_array["param_text_position"]=="bottom" and $module["body"]!="")
$temp .= '<p>'.nl2br($module["body"]).'</p>';
}
}
else if ($module["mod_type"]==11) // Tabs
{
$included_modules_ids = end(explode("=",$module_parameters_array["param_included_modules"]));
$included_modules_ids_array = explode(",", $included_modules_ids);
$included_modules_array = array();
$temp .= '<div class="tabs" style="white-space: nowrap;"><ul>';
$c = 0;
foreach ($included_modules_ids_array as $module_id)
{
++$c;
$tab_classes = "tab".$c;
if ($c==1)
$tab_classes .= " active";
$module_item = $modules->getModuleById($module_id);
$included_modules_array[] = $module_item;
$temp .= '<li><a href="#" class="'.$tab_classes.'">'.$module_item["title"].'</a></li>';
}
$temp .= '</ul></div>';
$c = 0;
foreach ($included_modules_array as $module_item)
{
++$c;
$extra_classes = "tab".$c;
if ($c>1)
$extra_classes .= " hide";
$temp .= buildModuleHtml($module_item, $extra_classes);
}
}
else if ($module["mod_type"]==12) // Υπο-μενού
{
if ($module_parameters_array["param_parent_category"]=="-1") // Τρέχουσα κατηγορία
{
$parent_category = $category_settings["id"];
$parent_category_title = $category_settings["title"];
}
else if ($module_parameters_array["param_parent_category"]=="0") // Τρέχουσα ριζική κατηγορία
{
$parent_category = $cat_path['id'][0];
$parent_category_title = $cat_path['title'][0];
}
else
{
$parent_category = $module_parameters_array["param_parent_category"]; // Επιλεγμένη κατηγορία
$parent_category_data = $categories->getCategoryById($parent_category);
$parent_category_title = $parent_category_data["title"];
}
if ($module_parameters_array["param_show_sublevels"]=="1")
$level_depth = $module_parameters_array["param_level_depth"];
else
$level_depth = 1;
$sub_menu = $categories->buildMenu($parent_category, $cat_path['id'], $level_depth); // Καταχώρησε στη μεταβλητή $sub_menu σε HTML όλη τη δομή του υπο-μενού (ul>li>ul>li κλπ)
$temp .= '<ul><li class="active"><a href="index.php?cat_id='.$parent_category.'">'.$parent_category_title.'</a>'.$sub_menu.'</li></ul>';
}
else if ($module["mod_type"]==13) // Ημερολόγιο
{
$monthNames = array('January'=>_JANUARY,'February'=>_FEBRUARY,'March'=>_MARCH,'April'=>_APRIL,'May'=>_MAY,'June'=>_JUNE,'July'=>_JULY,'August'=>_AUGUST,'September'=>_SEPTEMBER,'October'=>_OCTOBER,'November'=>_NOVEMBER,'December'=>_DECEMBER,'Jan'=>_OF_JANUARY_SHORT,'Feb'=>_OF_FEBRUARY_SHORT,'Mar'=>_OF_MARCH_SHORT,'Apr'=>_OF_APRIL_SHORT,'May'=>_OF_MAY_SHORT,'Jun'=>_OF_JUNE_SHORT,'Jul'=>_OF_JULY_SHORT,'Aug'=>_OF_AUGUST_SHORT,'Sep'=>_OF_SEPTEMBER_SHORT,'Oct'=>_OF_OCTOBER_SHORT,'Nov'=>_OF_NOVEMBER_SHORT,'Dec'=>_OF_DECEMBER_SHORT);
$dayNamesMin = array(_SUNDAY_SHORT, _MONDAY_SHORT, _TUESDAY_SHORT, _WEDNESDAY_SHORT, _THURSDAY_SHORT, _FRIDAY_SHORT, _SATURDAY_SHORT);
if (preg_match("/^\d\d\d\d-[0-1]\d-[0-3]\d$/", $date)) // Αν έχει δοθεί πλήρης ημερομηνία με έτος, μήνα, μέρα
$fulldate = true;
else
$fulldate = false;
// Πάρε τη δοσμένη μέρα
$date = strtotime ($date) ;
$day = date('d', $date) ;
$month = date('m', $date) ;
$year = date('Y', $date) ;
$next_year = $year+1;
$prev_year = $year-1;
if ($month=="01")
{
$next_month = "02";
$prev_month = "12";
}
else if ($month=="12")
{
$next_month = "01";
$prev_month = "11";
}
else
{
$next_month = ($month+1<10?"0":"").($month+1);
$prev_month = ($month-1<10?"0":"").($month-1);
}
// Βρες την πρώτη μέρα του μήνα
$first_day = mktime(0, 0, 0, $month, 1, $year);
// Το όνομα του μήνα
$monthname = $monthNames[date('F', $first_day)];
// Βρες ποια μέρα της εβδομάδας πέφτει η πρώτη μέρα του μήνα
$day_of_week = date('D', $first_day) ;
// Ξέρωντας ποια μέρα της εβδομάδας είναι η πρώτη μέρα του μήνα, βρίσκουμε πόσες κενές μέρες υπάρχουν πριν από αυτήν.
switch($day_of_week)
{
case "Mon": $blank = 0; break;
case "Tue": $blank = 1; break;
case "Wed": $blank = 2; break;
case "Thu": $blank = 3; break;
case "Fri": $blank = 4; break;
case "Sat": $blank = 5; break;
case "Sun": $blank = 6; break;
}
// Πόσες μέρες έχει ο μήνας
$days_in_month = cal_days_in_month(0, $month, $year) ;
// Δημιούργησε πίνακα που περιέχει ανα μέρα πόσες ανακοινώσεις (ενεργές και ανενεργές) αναρτήθηκαν τη μέρα αυτή για τις επιλεγμένες κατηγορίες του ενθέματος ημερολογίου
$contents_per_day = $content->getNumOfContentsPerDay($year."-".$month, explode(",",$module_parameters_array["param_category_ids"]), $state=2);
// Δημιουργία του πίνακα
$temp .= '<table>';
$temp .= '<tr><th class="calendar_navigation" colspan="7"><a href="index.php?action=calendar&date='.$prev_year.'-'.$month.'&category_ids='.$module_parameters_array["param_category_ids"].'" class="prev_year" title="'._PREV_YEAR.'"><<</a><a href="index.php?action=calendar&date='.($month=="01"?($year-1):$year).'-'.$prev_month.'&category_ids='.$module_parameters_array["param_category_ids"].'" class="prev_month" title="'._PREV_ΜΟΝΤΗ.'"><</a><a href="index.php?action=calendar&date='.$year.'-'.$month.'&category_ids='.$module_parameters_array["param_category_ids"].'" title="'.$monthname.' '.$year.'">'.$monthname.' '.$year.'</a><a href="index.php?action=calendar&date='.$next_year.'-'.$month.'&category_ids='.$module_parameters_array["param_category_ids"].'" class="next_year" title="'._NEXT_YEAR.'">>></a><a href="index.php?action=calendar&date='.($month=="12"?($year+1):$year).'-'.$next_month.'&category_ids='.$module_parameters_array["param_category_ids"].'" class="next_month" title="'._NEXT_ΜΟΝΤΗ.'">></a></th></tr>';
$temp .= '<tr class="weekdays"><td>'.$dayNamesMin[1].'</td><td>'.$dayNamesMin[2].'</td><td>'.$dayNamesMin[3].'</td><td>'.$dayNamesMin[4].'</td><td>'.$dayNamesMin[5].'</td><td>'.$dayNamesMin[6].'</td><td>'.$dayNamesMin[0].'</td></tr>';
$day_count = 1;
$temp .= '<tr>';
// Πρώτα εισαγωγή των κενών
while ($blank>0)
{
$temp .= '<td></td>';
$blank = $blank-1;
$day_count++;
}
// Έναρξη των κανονικών ημερών του μήνα
$day_num = 1;
// Προσθήκη όλων των ημερών του μήνα
while ( $day_num <= $days_in_month )
{
$extra_class = "";
if ($day_num == (int) $day and $fulldate==true) // Αν το κελί αντιστοιχεί στη δοσμένη ημέρα θέσε την αντίστοιχη κλάση
$extra_class .= " currentday";
$temp .= '<td class="monthday'.$extra_class.'">';
if ($contents_per_day[$day_num]>0)
{
$temp .= '<a href="index.php?action=calendar&date='.$year.'-'.$month.'-'.($day_num<10?'0':'').$day_num.'&category_ids='.$module_parameters_array["param_category_ids"].'" title="'.$contents_per_day[$day_num].' '._POSTS.'">'.$day_num.'</a>';
}
else
{
$temp .= $day_num;
}
$temp .= '</td>';
$day_num++;
$day_count++;
// Νέα γραμμή κάθε εβδομάδα
if ($day_count > 7)
{
$temp .= '</tr><tr>';
$day_count = 1;
}
}
// Εισαγωγή κενών στο τέλος του πίνακα
while ( $day_count >1 && $day_count <=7)
{
$temp .= '<td> </td>';
$day_count++;
}
$temp .= '</tr></table>';
}
else if ($module["mod_type"]==14) // Sitemap
{
$temp .= $categories->buildMenu(0);
}
else if ($module["mod_type"]==15) // Τελευταίες εικόνες από φωτογραφικά άλμπουμ
{
$category_ids_array = array();
if ($module_parameters_array["param_photogalleries_ids"]!="")
$category_ids_array = explode(",", $module_parameters_array["param_photogalleries_ids"]);
$photos_array = $galleries->getCategoriesRandomThumbnails($category_ids_array, $module_parameters_array["param_count"]);
foreach ($photos_array as $photo)
{
$parent_category = $galleries->getCategoryById($photo["category_id"]);
$temp .= '<a href="'.$galleries->photogalleries_path.'/photos/'.$parent_category["catpath"].'/'.$photo["filename"].'" rel="gallery" title="'.$photo["title"].'"><img src="'.$galleries->photogalleries_path.'/thumbnails/'.$parent_category["catpath"].'/'.$photo["filename"].'" alt="'.$photo["title"].'" /></a>';
}
}
else if ($module["mod_type"]==16) // Google map
{
if ($google_maps_counter==0)
{
//$header_data .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>'.PHP_EOL;
$header_data .= '<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDFK3OwvK9ulohqK5SS_Zcov8iZkN00x6Y&callback=initMap"></script>'.PHP_EOL;
}
$temp .= '<script type="text/javascript">'.PHP_EOL;
$temp .= 'var map_'.$google_maps_counter.';'.PHP_EOL;
$temp .= 'var directionsService_'.$google_maps_counter.' = new google.maps.DirectionsService();'.PHP_EOL;
$temp .= 'var directionsDisplay_'.$google_maps_counter.' = new google.maps.DirectionsRenderer();'.PHP_EOL;
$temp .= 'function initialize_'.$google_maps_counter.'() {'.PHP_EOL;
$temp .= 'var map_latlng = new google.maps.LatLng('.$module_parameters_array["param_map_latitude"].','.$module_parameters_array["param_map_longitude"].');'.PHP_EOL;
$temp .= 'var map_zoom = '.$module_parameters_array["param_map_zoom"].';'.PHP_EOL;
$temp .= 'var marker_title = "'.$module_parameters_array["param_marker_title"].'";'.PHP_EOL;
$temp .= 'var marker_image_path = "'.$module_parameters_array["param_marker_image"].'";'.PHP_EOL;
$temp .= 'var infowindow_content = \''.str_replace(array("\r\n", "\n", "\r"), "", $module["body"]).'\';'.PHP_EOL; // Αφαίρεση όλων των αλλαγών γραμμής
if ($module_parameters_array["param_show_marker"]==1 and $module_parameters_array["param_show_directions"]!=1)
$temp .= 'var marker_visible = true;'.PHP_EOL.PHP_EOL;
else
$temp .= 'var marker_visible = false;'.PHP_EOL.PHP_EOL;
$temp .= 'var options = {'.PHP_EOL;
$temp .= 'zoom: map_zoom,'.PHP_EOL;
$temp .= 'center: map_latlng,'.PHP_EOL;
$temp .= 'draggable: true,'.PHP_EOL;
$temp .= 'mapTypeId: google.maps.MapTypeId.ROADMAP'.PHP_EOL;
$temp .= '};'.PHP_EOL.PHP_EOL;
$temp .= 'map_'.$google_maps_counter.' = new google.maps.Map(document.getElementById(\'map_canvas_'.$google_maps_counter.'\'), options);'.PHP_EOL.PHP_EOL;
$temp .= 'directionsDisplay_'.$google_maps_counter.'.setMap(map_'.$google_maps_counter.');'.PHP_EOL;
$temp .= 'directionsDisplay_'.$google_maps_counter.'.setPanel(document.getElementById(\'directions_'.$google_maps_counter.'\'));'.PHP_EOL.PHP_EOL;
if ($module_parameters_array["param_show_directions"]==1)
$temp .= 'calcRoute(map_'.$google_maps_counter.', directionsService_'.$google_maps_counter.', directionsDisplay_'.$google_maps_counter.', \''.$module_parameters_array["param_directions_fromaddress"].'\', map_latlng);'.PHP_EOL;
$temp .= 'var marker_image =\''.$module_parameters_array["param_marker_image"].'\''.PHP_EOL.PHP_EOL;
$temp .= 'var marker = new google.maps.Marker({'.PHP_EOL;
$temp .= 'position: map_latlng,'.PHP_EOL;
$temp .= 'icon: marker_image,'.PHP_EOL;
$temp .= 'shadow: \'\','.PHP_EOL;
$temp .= 'map: map_'.$google_maps_counter.','.PHP_EOL;
$temp .= 'title: marker_title,'.PHP_EOL;
$temp .= 'visible: marker_visible'.PHP_EOL;
$temp .= '});'.PHP_EOL.PHP_EOL;
$temp .= 'var infowindow = new google.maps.InfoWindow({'.PHP_EOL;
$temp .= 'content: infowindow_content'.PHP_EOL;
$temp .= '});'.PHP_EOL.PHP_EOL;
$temp .= 'google.maps.event.addListener(marker, \'click\', function() {'.PHP_EOL;
$temp .= 'infowindow.open(map_'.$google_maps_counter.', marker);'.PHP_EOL;
$temp .= '});'.PHP_EOL;
$temp .= '}'.PHP_EOL.PHP_EOL;
if ($google_maps_counter==0) // Βάλε τη συνάρτηση calcRoute μια φορά στη σελίδα σε περίπτωση που υπάρχουν περισσότεροι από ένας χάρτες ταυτόχρονα
{
$temp .= 'function calcRoute(map, directionsService, directionsDisplay, fromaddress, toaddress)'.PHP_EOL;
$temp .= '{'.PHP_EOL;
$temp .= 'var request = {'.PHP_EOL;
$temp .= 'origin: fromaddress,'.PHP_EOL;
$temp .= 'destination: toaddress,'.PHP_EOL;
$temp .= 'travelMode: google.maps.DirectionsTravelMode.DRIVING'.PHP_EOL;
$temp .= '};'.PHP_EOL;
$temp .= 'directionsService.route(request, function(response, status) {'.PHP_EOL;
$temp .= 'if (status == google.maps.DirectionsStatus.OK)'.PHP_EOL;
$temp .= '{'.PHP_EOL;
$temp .= 'directionsDisplay.setDirections(response);'.PHP_EOL;
$temp .= '}'.PHP_EOL;
$temp .= '});'.PHP_EOL;
$temp .= '}'.PHP_EOL.PHP_EOL;
}
$temp .= 'google.maps.event.addDomListener(window, \'load\', initialize_'.$google_maps_counter.');'.PHP_EOL;
$temp .= '</script>'.PHP_EOL;
$temp .= '<div id="map_canvas_'.$google_maps_counter.'" style="width:'.$module_parameters_array["param_map_width"].'px; height:'.$module_parameters_array["param_map_height"].'px"></div>';
if ($module_parameters_array["param_show_directions"]==2)
{
$temp .= '<div id="directions_form_'.$google_maps_counter.'" class="directions_form">';
$temp .= '<form action="index.php" method="post" onsubmit="calcRoute(map_'.$google_maps_counter.', directionsService_'.$google_maps_counter.', directionsDisplay_'.$google_maps_counter.', fromaddress.value, new google.maps.LatLng('.$module_parameters_array["param_map_latitude"].','.$module_parameters_array["param_map_longitude"].')); return false;">';
$temp .= '<label for="street">Οδηγίες πρόσβασης από:</label><input class="fromaddress" name="fromaddress" type="text" />';
$temp .= '<input name="submit" type="submit" value="Λήψη Οδηγιών" class="button" />';
$temp .= '</form>';
$temp .= '</div>';
}
$temp .= '<div id="directions_'.$google_maps_counter.'"></div>';
++$google_maps_counter;
}
else if ($module["mod_type"]==17) // Photo Slider
{
if ($sliders_counter==0)
{
$header_data .= '<script type="text/javascript" src="js/nivo-slider/jquery.nivo.slider.js"></script>'.PHP_EOL;
$header_data .= '<link rel="stylesheet" type="text/css" href="js/nivo-slider/nivo-slider.css" />'.PHP_EOL;
$header_data .= '<script type="text/javascript">'.PHP_EOL;
$header_data .= '$(window).load(function(){'.PHP_EOL;
$header_data .= '$(".nivoSlider").nivoSlider({'.PHP_EOL;
$header_data .= 'effect: "'.$module_parameters_array["param_effect"].'",'.PHP_EOL;
$header_data .= 'slices: '.(int) $module_parameters_array["param_slices"].','.PHP_EOL;
$header_data .= 'boxCols: '.(int) $module_parameters_array["param_boxcols"].','.PHP_EOL;
$header_data .= 'boxRows: '.(int) $module_parameters_array["param_boxrows"].','.PHP_EOL;
$header_data .= 'animSpeed: '.(int) $module_parameters_array["param_speed"].','.PHP_EOL;
$header_data .= 'pauseTime: '.(int) $module_parameters_array["param_pause"].','.PHP_EOL;
$header_data .= 'directionNav: '.(int) $module_parameters_array["param_directionnav"].','.PHP_EOL;
$header_data .= 'directionNavHide: '.(int) $module_parameters_array["param_directionnavhide"].','.PHP_EOL;
$header_data .= 'controlNav: '.(int) $module_parameters_array["param_controlnav"].','.PHP_EOL;
$header_data .= 'pauseOnHover: 0'.PHP_EOL;
$header_data .= '});});'.PHP_EOL;
$header_data .= '</script>'.PHP_EOL;
}
$temp .= '<div class="nivoSlider">';
$max_num_of_photos = $module_parameters_array["param_count"];
$photos_dir = $module_parameters_array["param_photos_folder"];
$photos_array = array();
if ($module["body"]!="")
{
$rows_arr = explode("#", $module["body"]);
if (!empty($rows_arr) and count($rows_arr)>0)
{
foreach ($rows_arr as $row)
{
$attr_arr = explode("|", $row);
$alt_array[] = $attr_arr[0];
$title_array[] = $attr_arr[1];
$url_array[] = $attr_arr[2];
}
}
}
if(is_dir($photos_dir))
{
$cur_dir = opendir($photos_dir);
while ($file = readdir($cur_dir))
{
$ext = pathinfo($file, PATHINFO_EXTENSION);
if($file!="." and $file!=".." and ($ext=="jpg" or $ext=="gif" or $ext=="png"))
{
$photos_array[] = $file;
}
}
}
if (!empty($photos_array) and count($photos_array)>0)
{
if ($max_num_of_photos>count($photos_array))
$max_num_of_photos = count($photos_array);
// Επιλογή ενός πλήθους ($max_num_of_photos) τυχαίων στοιχείων του πίνακα $photos_array
$selected_photos_array = $system->uniqueRandomNumbersWithinRange(0, (count($photos_array)-1), $max_num_of_photos);
for ($i=0; $i<$max_num_of_photos; ++$i)
{
if ($url_array[$i]!="")
{
$temp .= '<a href="'.$url_array[$i].'"'.($module_parameters_array["param_link_target"]=="1"?' target="_blank"':'').'>';
}
$temp .= '<img src="'.$photos_dir.'/'.($module_parameters_array["param_photo_selection"]=="0"?$photos_array[$i]:$photos_array[$selected_photos_array[$i]]).'" alt="'.$alt_array[$i].'" title="'.$title_array[$i].'" />';
if ($url_array[$i]!="")
$temp .= '</a>';
}
}
$temp .= '</div>';
++$sliders_counter;
}
else if ($module["mod_type"]==18) // Social Media Buttons
{
if ($module_parameters_array["param_fbshare_show"]=="1" or $module_parameters_array["param_fblike_show"]=="1" or $module_parameters_array["param_fbfollow_show"]=="1")
{
$temp .= '<div id="fb-root"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/'.($module_parameters_array["param_fbshare_lang"]!=""?$module_parameters_array["param_fbshare_lang"]:$locale).'/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));</script>';
}
if ($module_parameters_array["param_twittershare_show"]=="1" or $module_parameters_array["param_twitterfollow_show"]=="1")
{
$temp .= '<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script>';
}
if ($module_parameters_array["param_gplus_show"]=="1")
{
$temp .= '<script type="text/javascript">window.___gcfg = {lang: "'.($module_parameters_array["param_gplus_lang"]!=""?$module_parameters_array["param_gplus_lang"]:$lang).'"};(function() {var po = document.createElement("script"); po.type = "text/javascript"; po.async = true; po.src = "https://apis.google.com/js/plusone.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);})();</script>';
}
if ($module_parameters_array["param_linkedinshare_show"]=="1")
{
$temp .= '<script src="//platform.linkedin.com/in.js" type="text/javascript">lang: '.($module_parameters_array["param_linkedinshare_lang"]!=""?$module_parameters_array["param_linkedinshare_lang"]:$locale).'</script>';
}
$temp .= '<ul>';
if ($module_parameters_array["param_fbshare_show"]=="1")
{
$temp .= '<li class="fb-share-button"><div class="fb-share-button" data-href="'.$system->fullURL().'" data-type="'.$module_parameters_array["param_fbshare_layout"].'"'.($module_parameters_array["param_fbshare_width"]!=""?' data-width="'.$module_parameters_array["param_fbshare_width"].'"':'').'></div></li>';
}
if ($module_parameters_array["param_fblike_show"]=="1")
{
$temp .= '<li class="fb-like-button"><div class="fb-like" data-href="'.$system->fullURL().'" data-layout="'.$module_parameters_array["param_fblike_layout"].'" data-action="'.$module_parameters_array["param_fblike_action"].'" data-show-faces="false" data-share="false"'.($module_parameters_array["param_fblike_width"]!=""?' data-width="'.$module_parameters_array["param_fblike_width"].'"':'').'></div></li>';
}
if ($module_parameters_array["param_fblikebox_show"]=="1")
{
$temp .= '<li class="fb-likebox-button"><div class="fb-like-box" data-href="http://www.facebook.com/'.trim($module_parameters_array["param_fblikebox_href"]).'"'.($module_parameters_array["param_fblikebox_width"]!=""?' data-width="'.$module_parameters_array["param_fblikebox_width"].'"':"").($module_parameters_array["param_fblikebox_height"]!=""?' data-height="'.$module_parameters_array["param_fblikebox_height"].'"':"").' data-colorscheme="light" data-show-faces="true" data-header="'.$param_fblikebox_showheader.'" data-stream="false" data-show-border="'.$module_parameters_array["param_fblikebox_showborder"].'"></div></li>';
$temp .= '<li class="fb-likebox-button"><div class="fb-like" data-href="'.$system->fullURL().'" data-layout="'.$module_parameters_array["param_fblike_layout"].'" data-action="'.$module_parameters_array["param_fblike_action"].'" data-show-faces="false" data-share="false"'.($module_parameters_array["param_fblike_width"]!=""?' data-width="'.$module_parameters_array["param_fblike_width"].'"':'').'></div></li>';
}
if ($module_parameters_array["param_fbfollow_show"]=="1")
{
$temp .= '<li class="fb-like-button"><div class="fb-follow" data-href="http://www.facebook.com/'.trim($module_parameters_array["param_fbfollow_href"]).'"'.($module_parameters_array["param_fbfollow_width"]!=""?' data-width="'.$module_parameters_array["param_fbfollow_width"].'"':'').' data-colorscheme="light" data-layout="'.$module_parameters_array["param_fbfollow_layout"].'" data-show-faces="false"></div></li>';
}
if ($module_parameters_array["param_twittershare_show"]=="1")
{
$temp .= '<li class="twitter-share-button"><a href="'.$system->fullURL().'" class="twitter-share-button" data-count="'.$module_parameters_array["param_twittershare_layout"].'" data-lang="'.($module_parameters_array["param_twittershare_lang"]!=""?$module_parameters_array["param_twittershare_lang"]:$lang).'">Tweet</a></li>';
}
if ($module_parameters_array["param_twitterfollow_show"]=="1")
{
$temp .= '<li class="twitter-follow-button"><a href="https://twitter.com/'.trim($module_parameters_array["param_twitterfollow_user"]).'" class="twitter-follow-button" data-show-count="false" data-dnt="true" data-lang="'.($module_parameters_array["param_twittershare_lang"]!=""?$module_parameters_array["param_twittershare_lang"]:$lang).'"'.($module_parameters_array["param_twitterfollow_showusername"]!="1"?" data-show-screen-name=\"false\"":"").'>Follow @'.trim($module_parameters_array["param_twitterfollow_user"]).'</a></li>';
}
if ($module_parameters_array["param_gplus_show"]=="1")
{
$temp .= '<li class="gplus-button"><div class="g-plusone" data-size="'.$module_parameters_array["param_gplus_layout"].'" data-href="'.$system->fullURL().'"></div></li>';
}
if ($module_parameters_array["param_linkedinshare_show"]=="1")
{
$temp .= '<li class="linkedin-share-button"><script type="IN/Share" data-url="'.$system->fullURL().'" data-counter="'.($module_parameters_array["param_linkedinshare_layout"]!=""?$module_parameters_array["param_linkedinshare_layout"]:"none").'"></script></li>';
}
$temp .= '</ul>';
}
else if ($module["mod_type"]==19) // Newsletter
{
if ($module_parameters_array["param_text_position"]=="top" and $module["body"]!="")
$temp .= '<p>'.nl2br($module["body"]).'</p>';
$temp .= '<form method="post" action="index.php">';
$temp .= '<input type="hidden" name="action" value="newsletter_register_submit" />';
$temp .= '<input type="hidden" name="form_id" value="'.$system->genRandomString().'" />';
if ($module_parameters_array["param_show_name_field"]==1 and $module_parameters_array["param_show_req_name"]==1)
$temp .= '<input type="hidden" name="name_required" value="1" />';
if ($module_parameters_array["param_show_name_field"]==1)
$temp .= '<div><input type="text" name="name" title="'._ΝΑΜΕ.'"></div>';
$temp .= '<div><input type="text" name="email" title="Email"></div>';
$temp .= '<div><input type="submit" name="submit" value="'._REGISTRATION.'" /></div>';
$temp .= '</form>';
if ($module_parameters_array["param_text_position"]=="bottom" and $module["body"]!="")
$temp .= '<p>'.nl2br($module["body"]).'</p>';
}
$temp .= '<div class="clear"></div></div></div>';
return $temp;
}
?>