function msg($key, $p0 = '', $p1 = '', $p2 = '', $p3 = '', $p4 = '', $p5 = '', $p6 = '', $p7 = '', $p8 = '', $p9 = '')
 {
     global $REX;
     if (isset($this->text[$key])) {
         $msg = $this->text[$key];
     } else {
         $msg = '';
     }
     // falls der key nicht gefunden wurde, auf die fallbacksprache switchen
     if ($msg == '') {
         if (!$this->isFallback()) {
             // fallbackobjekt ggf anlegen
             if (!$this->isFallback() && $this->fallback == null) {
                 $this->fallback = rex_create_lang($this->fallback_locale, $this->searchpath);
             }
             // suchen des keys in der fallbacksprache
             return $this->fallback->msg($key, $p0, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9);
         } else {
             trigger_error('Schluessel "' . $key . '" konnte weder in der ausgewälten noch in der Fallbacksprache gefunden werden!', E_USER_ERROR);
         }
     }
     $patterns = array('/\\{0\\}/', '/\\{1\\}/', '/\\{2\\}/', '/\\{3\\}/', '/\\{4\\}/', '/\\{5\\}/', '/\\{6\\}/', '/\\{7\\}/', '/\\{8\\}/', '/\\{9\\}/');
     $replacements = array($p0, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9);
     return preg_replace($patterns, $replacements, $msg);
 }
/**
 * URL Funktionen
 * @package redaxo4
 * @version svn:$Id$
 */
function rex_parse_article_name($name)
{
    static $firstCall = true;
    static $search, $replace;
    if ($firstCall) {
        global $REX, $I18N;
        // Im Frontend gibts kein I18N
        if (!$I18N) {
            $I18N = rex_create_lang($REX['LANG']);
        }
        // Sprachspezifische Sonderzeichen Filtern
        $search = explode('|', $I18N->msg('special_chars'));
        $replace = explode('|', $I18N->msg('special_chars_rewrite'));
        $firstCall = false;
    }
    return str_replace('+', '-', urlencode(preg_replace('/ {2,}/', ' ', preg_replace('/[^a-zA-Z_\\-0-9 ]/', '', str_replace($search, $replace, $name)))));
}
 static function _formatStrftime($value, $format)
 {
     global $I18N;
     if (!is_object($I18N)) {
         $I18N = rex_create_lang();
     }
     if (empty($value)) {
         return '';
     }
     if ($format == '' || $format == 'date') {
         // Default REX-Dateformat
         $format = $I18N->msg('dateformat');
     } elseif ($format == 'datetime') {
         // Default REX-Datetimeformat
         $format = $I18N->msg('datetimeformat');
     }
     return strftime($format, $value);
 }
Esempio n. 4
0
 protected function configurePackage()
 {
     global $REX, $I18N;
     self::arraySet($this->package, 'rex.backend', $REX['REDAXO']);
     self::arraySet($this->package, 'rex.user', $REX['USER']);
     $REX['ADDON']['rxid'][$this->package['name']] = '';
     $REX['ADDON']['name'][$this->package['name']] = $this->package['title'];
     $REX['ADDON']['version'][$this->package['name']] = $this->package['version'];
     $REX['ADDON']['author'][$this->package['name']] = $this->package['author'];
     $REX['ADDON']['supportpage'][$this->package['name']] = $this->package['supportpage'];
     $REX['ADDON']['perm'][$this->package['name']] = $this->package['permission_startpage'];
     $REX['ADDON']['pages'][$this->package['name']] = self::arrayGet($this->package, 'package.pages');
     if ($this->package['permission'] != '') {
         $REX['PERM'][] = $this->package['permission'];
     }
     if (count($this->package['permission_options']) > 0) {
         $REX['EXTPERM'][] = $this->package['permission_options'];
     }
     if (!is_object($I18N)) {
         $I18N = rex_create_lang($REX['LANG']);
     }
     $package_lang_dirs = self::arrayGet($this->package, 'package.providers.i18n');
     $package_lang_dirs[] = self::arrayGet($this->package, 'path.package') . '/lang';
     if (count($package_lang_dirs)) {
         foreach ($package_lang_dirs as $package_lang_dir) {
             if (is_dir($package_lang_dir)) {
                 $I18N->appendFile($package_lang_dir);
             }
         }
     }
 }
Esempio n. 5
0
        // login failed
        $rex_user_loginmessage = $REX['LOGIN']->message;
        // Fehlermeldung von der Datenbank
        if (is_string($loginCheck)) {
            $rex_user_loginmessage = $loginCheck;
        }
        $REX['PAGES']['login'] = rex_be_navigation::getLoginPage();
        $REX['PAGE'] = 'login';
        $REX['USER'] = null;
        $REX['LOGIN'] = null;
    } else {
        // Userspezifische Sprache einstellen, falls gleicher Zeichensatz
        $lang = $REX['LOGIN']->getLanguage();
        $I18N_T = rex_create_lang($lang, '', FALSE);
        if ($I18N->msg('htmlcharset') == $I18N_T->msg('htmlcharset')) {
            $I18N = rex_create_lang($lang);
        }
        $REX['USER'] = $REX['LOGIN']->USER;
    }
}
// ----- Prepare Core Pages
if ($REX['USER']) {
    $REX['PAGES'] = rex_be_navigation::getLoggedInPages($REX['USER']);
}
// ----- INCLUDE ADDONS
include_once $REX['INCLUDE_PATH'] . '/addons.inc.php';
// ----- Prepare AddOn Pages
if ($REX['USER']) {
    foreach (OOAddon::getAvailableAddons() as $addonName) {
        $title = OOAddon::getProperty($addonName, 'name', '');
        $href = OOAddon::getProperty($addonName, 'link', 'index.php?page=' . $addonName);
 /**
  * Prüft die mit setLogin() und setPassword() gesetzten Werte
  * anhand des LoginQueries/UserQueries und gibt den Status zurück
  *
  * Gibt true zurück bei erfolg, sonst false
  */
 function checkLogin()
 {
     global $REX, $I18N;
     if (!is_object($I18N)) {
         $I18N = rex_create_lang();
     }
     // wenn logout dann header schreiben und auf error seite verweisen
     // message schreiben
     $ok = false;
     if (!$this->logout) {
         // LoginStatus: 0 = noch checken, 1 = ok, -1 = not ok
         // checkLogin schonmal ausgeführt ? gecachte ausgabe erlaubt ?
         if ($this->cache) {
             if ($this->login_status > 0) {
                 return true;
             } elseif ($this->login_status < 0) {
                 return false;
             }
         }
         if ($this->usr_login != '') {
             // wenn login daten eingegeben dann checken
             // auf error seite verweisen und message schreiben
             $this->USER = new rex_login_sql($this->DB);
             $USR_LOGIN = $this->usr_login;
             $USR_PSW = $this->usr_psw;
             $query = str_replace('USR_LOGIN', $this->usr_login, $this->login_query);
             $query = str_replace('USR_PSW', $this->usr_psw, $query);
             $this->USER->setQuery($query);
             if ($this->USER->getRows() == 1) {
                 $ok = true;
                 $this->setSessionVar('UID', $this->USER->getValue($this->uid));
                 $this->sessionFixation();
             } else {
                 $this->message = $I18N->msg('login_error', $REX['RELOGINDELAY']);
                 $this->setSessionVar('UID', '');
             }
         } elseif ($this->getSessionVar('UID') != '') {
             // wenn kein login und kein logout dann nach sessiontime checken
             // message schreiben und falls falsch auf error verweisen
             $this->USER = new rex_login_sql($this->DB);
             $query = str_replace('USR_UID', $this->getSessionVar('UID'), $this->user_query);
             $this->USER->setQuery($query);
             if ($this->USER->getRows() == 1) {
                 if ($this->getSessionVar('STAMP') + $this->session_duration > time()) {
                     $ok = true;
                     $this->setSessionVar('UID', $this->USER->getValue($this->uid));
                 } else {
                     $this->message = $I18N->msg('login_session_expired');
                 }
             } else {
                 $this->message = $I18N->msg('login_user_not_found');
             }
         } else {
             $this->message = $I18N->msg('login_welcome');
             $ok = false;
         }
     } else {
         $this->message = $I18N->msg('login_logged_out');
         $this->setSessionVar('UID', '');
     }
     if ($ok) {
         // wenn alles ok dann REX[UID][system_id) schreiben
         $this->setSessionVar('STAMP', time());
     } else {
         // wenn nicht, dann UID loeschen und error seite
         $this->setSessionVar('STAMP', '');
         $this->setSessionVar('UID', '');
     }
     if ($ok) {
         $this->login_status = 1;
     } else {
         $this->login_status = -1;
     }
     return $ok;
 }
/**
 * Übersetzt den text $text, falls dieser mit dem prefix "translate:" beginnt.
 */
function rex_translate($text, $I18N_Catalogue = null, $use_htmlspecialchars = true)
{
    if (!$I18N_Catalogue) {
        global $REX, $I18N;
        if (!$I18N) {
            $I18N = rex_create_lang($REX['LANG']);
        }
        return rex_translate($text, $I18N, $use_htmlspecialchars);
    }
    $tranKey = 'translate:';
    $transKeyLen = strlen($tranKey);
    if (substr($text, 0, $transKeyLen) == $tranKey) {
        $text = $I18N_Catalogue->msg(substr($text, $transKeyLen));
    }
    if ($use_htmlspecialchars) {
        return htmlspecialchars($text);
    }
    return $text;
}
Esempio n. 8
0
$MSG['err'] = "";
$checkmodus = rex_request('checkmodus', 'float');
$send = rex_request('send', 'string');
$dbanlegen = rex_request('dbanlegen', 'string');
$noadmin = rex_request('noadmin', 'string');
$lang = rex_request('lang', 'string');
$export_addon_dir = $REX['INCLUDE_PATH'] . '/addons/import_export';
require_once $export_addon_dir . '/functions/function_folder.inc.php';
require_once $export_addon_dir . '/functions/function_import_folder.inc.php';
require_once $export_addon_dir . '/functions/function_import_export.inc.php';
// ---------------------------------- MODUS 0 | Start
if (!($checkmodus > 0 && $checkmodus < 10)) {
    $langpath = $REX['INCLUDE_PATH'] . '/lang';
    foreach ($REX['LANGUAGES'] as $l) {
        $isUtf8 = substr($l, -4) == 'utf8';
        $I18N_T = rex_create_lang($l, $langpath, FALSE);
        $label = $I18N_T->msg('lang');
        if ($isUtf8) {
            $label .= ' (utf-8)';
        }
        $langs[$l] = '<li><a href="index.php?checkmodus=0.5&amp;lang=' . $l . '"' . rex_tabindex() . '>' . $label . '</a></li>';
    }
    unset($I18N_T);
    // wenn nur eine Sprache -> direkte weiterleitung
    if (count($REX['LANGUAGES']) == 1) {
        header('Location: index.php?checkmodus=0.5&lang=' . key($langs));
        exit;
    }
    rex_setup_title('SETUP: SELECT LANGUAGE');
    echo '<h2 class="rex-hl2">Please choose a language!</h2>
        <div class="rex-area-content">
/**
 * Sendet den Content zum Client,
 * fügt ggf. HTTP1.1 cache headers hinzu
 *
 * @param $content string Inhalt des Artikels
 * @param $lastModified integer Last-Modified Timestamp
 * @param $cacheKey string Cachekey zur identifizierung des Caches
 * @param $environment string Die Umgebung aus der der Inhalt gesendet wird
 * (frontend/backend)
 * @param $sendcharset boolean TRUE, wenn der Charset mitgeschickt werden soll, sonst FALSE
 */
function rex_send_content($content, $lastModified, $etag, $environment, $sendcharset = false)
{
    global $REX;
    if ($sendcharset) {
        global $I18N;
        // Im Frontend gibts kein I18N
        if (!is_object($I18N)) {
            $I18N = rex_create_lang($REX['LANG']);
        }
        header('Content-Type: text/html; charset=' . $I18N->msg('htmlcharset'));
    }
    // ----- Last-Modified
    if ($REX['USE_LAST_MODIFIED'] === 'true' || $REX['USE_LAST_MODIFIED'] == $environment) {
        rex_send_last_modified($lastModified);
    }
    // ----- ETAG
    if ($REX['USE_ETAG'] === 'true' || $REX['USE_ETAG'] == $environment) {
        rex_send_etag($etag);
    }
    // ----- GZIP
    if ($REX['USE_GZIP'] === 'true' || $REX['USE_GZIP'] == $environment) {
        $content = rex_send_gzip($content);
    }
    // ----- MD5 Checksum
    // dynamische teile sollen die md5 summe nicht beeinflussen
    if ($REX['USE_MD5'] === 'true' || $REX['USE_MD5'] == $environment) {
        rex_send_checksum(md5(preg_replace('@<!--DYN-->.*<!--/DYN-->@', '', $content)));
    }
    // Evtl offene Db Verbindungen schließen
    rex_sql::disconnect(null);
    // content length schicken, damit der browser einen ladebalken anzeigen kann
    if (!ini_get('zlib.output_compression')) {
        header('Content-Length: ' . strlen($content));
    }
    echo $content;
}
/**
 * Übersetzt den text $text, falls dieser mit dem prefix "translate:" beginnt.
 */
function rex_translate($text, $I18N_Catalogue = null, $use_htmlspecialchars = true)
{
    if (!$I18N_Catalogue) {
        global $REX, $I18N;
        if (!$I18N) {
            $I18N = rex_create_lang($REX['LANG']);
        }
        if (!$I18N) {
            trigger_error('Unable to create language "' . $REX['LANG'] . '"', E_USER_ERROR);
        }
        return rex_translate($text, $I18N, $use_htmlspecialchars);
    }
    $tranKey = 'translate:';
    $transKeyLen = strlen($tranKey);
    if (substr($text, 0, $transKeyLen) == $tranKey) {
        $text = $I18N_Catalogue->msg(substr($text, $transKeyLen));
    }
    if ($use_htmlspecialchars) {
        return htmlspecialchars($text);
    }
    return $text;
}
/**
 * Sendet den Content zum Client,
 * fügt ggf. HTTP1.1 cache headers hinzu
 *
 * @param $content string Inhalt des Artikels
 * @param $lastModified integer Last-Modified Timestamp
 * @param $cacheKey string Cachekey zur identifizierung des Caches
 * @param $environment string Die Umgebung aus der der Inhalt gesendet wird
 * (frontend/backend)
 * @param $sendcharset boolean TRUE, wenn der Charset mitgeschickt werden soll, sonst FALSE
 */
function rex_send_content($content, $lastModified, $etag, $environment, $sendcharset = FALSE)
{
    global $REX;
    // Cachen erlauben, nach revalidierung
    // see http://xhtmlforum.de/35221-php-session-etag-header.html#post257967
    session_cache_limiter('none');
    header('Cache-Control: must-revalidate, proxy-revalidate, private');
    if ($sendcharset) {
        global $I18N;
        // Im Frontend gibts kein I18N
        if (!is_object($I18N)) {
            $I18N = rex_create_lang($REX['LANG']);
        }
        header('Content-Type: text/html; charset=' . $I18N->msg('htmlcharset'));
    }
    // ----- Last-Modified
    if ($REX['USE_LAST_MODIFIED'] === 'true' || $REX['USE_LAST_MODIFIED'] == $environment) {
        rex_send_last_modified($lastModified);
    }
    // ----- ETAG
    if ($REX['USE_ETAG'] === 'true' || $REX['USE_ETAG'] == $environment) {
        rex_send_etag($etag);
    }
    // ----- GZIP
    if ($REX['USE_GZIP'] === 'true' || $REX['USE_GZIP'] == $environment) {
        $content = rex_send_gzip($content);
    }
    // ----- MD5 Checksum
    // dynamische teile sollen die md5 summe nicht beeinflussen
    if ($REX['USE_MD5'] === 'true' || $REX['USE_MD5'] == $environment) {
        rex_send_checksum(md5(preg_replace('@<!--DYN-->.*<!--/DYN-->@', '', $content)));
    }
    // Evtl offene Db Verbindungen schließen
    rex_sql::disconnect(null);
    // content length schicken, damit der browser einen ladebalken anzeigen kann
    header('Content-Length: ' . strlen($content));
    echo $content;
}
/**
 * Erstellt einen SQL Dump, der die aktuellen Datebankstruktur darstellt.
 * Dieser wird in der Datei $filename gespeichert.
 *
 * @return boolean TRUE wenn ein Dump erstellt wurde, sonst FALSE
 */
function rex_a1_export_db($filename, array $tables = null)
{
    global $REX, $I18N;
    $fp = @fopen($filename, 'w');
    if (!$fp) {
        return false;
    }
    // Im Frontend gibts kein I18N
    if (!is_object($I18N)) {
        $I18N = rex_create_lang($REX['LANG']);
    }
    $sql = rex_sql::factory();
    $nl = "\n";
    $insertSize = 5000;
    // ----- EXTENSION POINT
    rex_register_extension_point('A1_BEFORE_DB_EXPORT');
    // Versionsstempel hinzufügen
    fwrite($fp, '## Redaxo Database Dump Version ' . $REX['VERSION'] . $nl);
    fwrite($fp, '## Prefix ' . $REX['TABLE_PREFIX'] . $nl);
    fwrite($fp, '## charset ' . $I18N->msg('htmlcharset') . $nl . $nl);
    //  fwrite($fp, '/*!40110 START TRANSACTION; */'.$nl);
    if (is_null($tables)) {
        $tables = array();
        foreach (rex_sql::showTables(1, $REX['TABLE_PREFIX']) as $table) {
            if ($table != $REX['TABLE_PREFIX'] . 'user' && substr($table, 0, strlen($REX['TABLE_PREFIX'] . $REX['TEMP_PREFIX'])) != $REX['TABLE_PREFIX'] . $REX['TEMP_PREFIX']) {
                // Tabellen die mit rex_tmp_ beginnne, werden nicht exportiert!
                $tables[] = $table;
            }
        }
    }
    foreach ($tables as $table) {
        //---- export metadata
        $create = rex_sql::showCreateTable($table);
        fwrite($fp, "DROP TABLE IF EXISTS `{$table}`;\n");
        fwrite($fp, "{$create};\n");
        $fields = $sql->getArray("SHOW FIELDS FROM `{$table}`");
        foreach ($fields as $idx => $field) {
            if (preg_match('#^(bigint|int|smallint|mediumint|tinyint|timestamp)#i', $field['Type'])) {
                $fields[$idx] = 'int';
            } elseif (preg_match('#^(float|double|decimal)#', $field['Type'])) {
                $fields[$idx] = 'double';
            } elseif (preg_match('#^(char|varchar|text|longtext|mediumtext|tinytext)#', $field['Type'])) {
                $fields[$idx] = 'string';
            }
            // else ?
        }
        //---- export tabledata
        $start = 0;
        $max = $insertSize;
        do {
            $sql->freeResult();
            $sql->setQuery("SELECT * FROM `{$table}` LIMIT {$start},{$max}");
            if ($sql->getRows() > 0 && $start == 0) {
                fwrite($fp, "\nLOCK TABLES `{$table}` WRITE;");
                fwrite($fp, "\n/*!40000 ALTER TABLE `{$table}` DISABLE KEYS */;");
            } elseif ($sql->getRows() == 0) {
                break;
            }
            $start += $max;
            $values = array();
            while ($sql->hasNext()) {
                $record = array();
                foreach ($fields as $idx => $type) {
                    $column = $sql->getValue($idx);
                    switch ($type) {
                        case 'int':
                            $record[] = intval($column);
                            break;
                        case 'double':
                            $record[] = sprintf('%.10F', (double) $column);
                            break;
                        case 'string':
                        default:
                            $record[] = $sql->escape($column, "'", true);
                            break;
                    }
                }
                $values[] = $nl . '  (' . implode(',', $record) . ')';
                $sql->next();
            }
            if (!empty($values)) {
                $values = implode(',', $values);
                fwrite($fp, "\nINSERT INTO `{$table}` VALUES {$values};");
                unset($values);
            }
        } while ($sql->getRows() >= $max);
        if ($start > 0) {
            fwrite($fp, "\n/*!40000 ALTER TABLE `{$table}` ENABLE KEYS */;");
            fwrite($fp, "\nUNLOCK TABLES;\n\n");
        }
    }
    fclose($fp);
    $hasContent = true;
    // Den Dateiinhalt geben wir nur dann weiter, wenn es unbedingt notwendig ist.
    if (rex_extension_is_registered('A1_AFTER_DB_EXPORT')) {
        $content = rex_get_file_contents($filename);
        $hashBefore = md5($content);
        // ----- EXTENSION POINT
        $content = rex_register_extension_point('A1_AFTER_DB_EXPORT', $content);
        $hashAfter = md5($content);
        if ($hashAfter != $hashBefore) {
            rex_put_file_contents($filename, $content);
            $hasContent = !empty($content);
            unset($content);
        }
    }
    return $hasContent;
}
 public static function syncData()
 {
     global $REX, $I18N;
     // error reporting
     if (HR4YOU_SYNC_DEBUG_MODE) {
         ini_set('display_startup_errors', 1);
         ini_set('display_errors', 1);
         error_reporting(-1);
     } else {
         ini_set('display_startup_errors', 0);
         ini_set('display_errors', 0);
         error_reporting(0);
     }
     // necessary stuff so mediapool function can work properly in frontend
     $REX['USER'] = new rex_fe_user();
     $I18N = rex_create_lang($REX['LANG']);
     include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_generate.inc.php';
     include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_mediapool.inc.php';
     // init logger
     $logFile = HR4YOU_SYNC_LOG_FILE_PATH;
     $log = KLogger::instance($logFile, KLogger::INFO);
     $phpLogErrors = ini_get('log_errors');
     $phperrorLog = ini_get('error_log');
     ini_set('log_errors', 1);
     ini_set('error_log', $log->getLogFilePath());
     $log->logInfo('======================================== START HR4YOU SYNC ========================================');
     $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
     $xmlUrl = $REX['ADDON']['hr4you_sync']['settings']['xml_url'];
     $defaultClangId = $REX['ADDON']['hr4you_sync']['settings']['default_clang_id'];
     $defaultArticleId = $REX['ADDON']['hr4you_sync']['settings']['default_article_id'];
     $defaultMediaCategoryId = $REX['ADDON']['hr4you_sync']['settings']['default_media_category_id'];
     $defaultJobCategoryId = $REX['ADDON']['hr4you_sync']['settings']['default_job_category_id'];
     $xmlString = file_get_contents($xmlUrl, false, $context);
     $jobs = new SimpleXMLElement($xmlString);
     // remove all previously synced jobs and media files
     $log->logInfo('>> [INF] remove all previously synced jobs and media files');
     $sql = rex_sql::factory();
     $sql->setDebug(HR4YOU_SYNC_DEBUG_MODE);
     rex_hr4you_sync_utils::logQuery($log, $sql, "SELECT * FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_stellen` WHERE hr4you_jobid > 0 ORDER BY stellen_id ASC");
     for ($i = 0; $i < $sql->getRows(); $i++) {
         $sql2 = rex_sql::factory();
         $sql2->setDebug(HR4YOU_SYNC_DEBUG_MODE);
         rex_hr4you_sync_utils::logQuery($log, $sql2, 'DELETE FROM `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_stellen` WHERE stellen_id = ' . $sql->getValue('stellen_id'));
         rex_hr4you_sync_utils::logQuery($log, $sql2, 'DELETE FROM `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_stellen_lang` WHERE stellen_id = ' . $sql->getValue('stellen_id'));
         // delete media
         $log->logInfo('>> [INF] delete media: ' . $sql->getValue('bild'));
         $media = OOMedia::getMediaByFileName($sql->getValue('bild'));
         if (is_object($media)) {
             $mediaInUse = $media->isInUse();
             if ($mediaInUse === false) {
                 if ($media->delete() !== false) {
                     // success
                     $log->logInfo('>> [INF] media deleted');
                 } else {
                     // failed
                     $log->logError('>> [ERR] media not deleted');
                 }
             } else {
                 $log->logInfo('>> [INF] media not deleted because still in use');
             }
         } else {
             $log->logInfo('>> [INF] media does not exist anymore');
         }
         $sql->next();
     }
     // add jobs
     $log->logInfo('>> [INF] add jobs');
     foreach ($jobs->entry as $job) {
         $sql = rex_sql::factory();
         $sql->setDebug(HR4YOU_SYNC_DEBUG_MODE);
         rex_hr4you_sync_utils::logQuery($log, $sql, "SELECT * FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_stellen` WHERE hr4you_jobid = " . $job->jobid);
         if ($sql->getRows() < 1) {
             // for safety reasons: only addon new job if it does not already exist
             // copy media file
             $log->logInfo('>> [INF] copy media file');
             $pathInfo = pathinfo($job->kopfgrafik_url);
             $originalFile = $pathInfo['basename'];
             $originalFileWithPath = $REX['MEDIAFOLDER'] . DIRECTORY_SEPARATOR . $originalFile;
             $mediaFile = self::rex_mediapool_filename_nosubindex($pathInfo['basename'], false);
             $mediaFileWithPath = $REX['MEDIAFOLDER'] . DIRECTORY_SEPARATOR . $mediaFile;
             if (!file_exists($mediaFileWithPath)) {
                 if (copy($job->kopfgrafik_url, $mediaFileWithPath)) {
                     $log->logInfo('>> [INF] media file sucessfully copied because it does not exist');
                 }
                 if (chmod($mediaFileWithPath, $REX['FILEPERM'])) {
                     $log->logInfo('>> [INF] media file chmod to: ' . $REX['FILEPERM']);
                 }
                 $mpSyncReturn = rex_mediapool_syncFile($mediaFile, $defaultMediaCategoryId, $job->kopfgrafik_name);
                 $log->logInfo('>> [INF] media file synced width return value: ', $mpSyncReturn);
             } else {
                 $log->logInfo('>> [INF] media file already exists');
             }
             // retrieve id of contact by email address
             $log->logInfo('>> [INF] retrieve id of contact by email address');
             $sql2 = rex_sql::factory();
             $sql2->setDebug(HR4YOU_SYNC_DEBUG_MODE);
             rex_hr4you_sync_utils::logQuery($log, $sql2, "SELECT kontakt_id FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_kontakt` WHERE email LIKE '" . $job->ap_email . "'");
             if ($sql2->getRows() > 0) {
                 //contact found
                 $contactId = $sql2->getValue('kontakt_id');
                 $log->logInfo('>> [INF] contact found! id:' . $contactId);
             } else {
                 $log->logInfo('>> [INF] contact not found. adding new contact');
                 $sql2 = rex_sql::factory();
                 $sql2->setDebug(HR4YOU_SYNC_DEBUG_MODE);
                 rex_hr4you_sync_utils::logQuery($log, $sql2, 'INSERT INTO `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_kontakt` (name, bild, telefon, email) VALUES ("' . $job->ap_vorname . ' ' . $job->ap_nachname . '","", "' . $job->ap_telefon . '", "' . $job->ap_email . '")');
                 $contactId = $sql2->getLastId();
                 $log->logInfo('>> [INF] contact id: ' . $contactId);
             }
             // checkout job category id as xml and addon ids are different
             $log->logInfo('>> [INF] checkout job category id as xml and addon ids are different');
             $sql2 = rex_sql::factory();
             $sql2->setDebug(HR4YOU_SYNC_DEBUG_MODE);
             rex_hr4you_sync_utils::logQuery($log, $sql2, "SELECT kategorie_id FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_kategorien` WHERE hr4you_berufskategorie_id LIKE '" . $job->berufskategorie_id . "'");
             if ($sql2->getRows() > 0) {
                 // job category found
                 $log->logInfo('>> [INF] job category found!');
                 $jobCategoryId = $sql2->getValue('kategorie_id');
             } else {
                 $log->logInfo('>> [INF] job category not found! using default job category id');
                 $jobCategoryId = $defaultJobCategoryId;
             }
             // add new job
             $log->logInfo('>> [INF] add new job');
             $sql2 = rex_sql::factory();
             $sql2->setDebug(HR4YOU_SYNC_DEBUG_MODE);
             rex_hr4you_sync_utils::logQuery($log, $sql2, 'INSERT INTO `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_stellen` (hr4you_jobid, interne_bezeichnung, interne_nummer, datum, status, kontakt_id, artikel_id, kategorie_ids, bild, hr4you_url_application_form) VALUES (' . $job->jobid . ',"' . $job->titel . '", ' . $job->referenznummer . ', "' . $job->von_datum . '", "online", ' . $contactId . ', ' . $defaultArticleId . ', "|' . $jobCategoryId . '|", "' . $mediaFile . '", "' . $job->url_application_form . '")');
             $theJobId = $sql2->getLastId();
             // get blocks and headings
             $block1 = self::trimString($job->block1_html);
             $block2 = self::trimString($job->block2_html);
             $block3 = self::trimString($job->block3_html);
             $headline1 = self::getHeadline($block1);
             $headline2 = self::getHeadline($block2);
             $headline3 = self::getHeadline($block3);
             include_once $REX['INCLUDE_PATH'] . '/addons/xoutputfilter/classes/class.xoutputfilter.inc.php';
             $xoutputFilter = new xoutputfilter();
             if ($block1 != '') {
                 if ($headline1 == '') {
                     $headline1 = $xoutputFilter->get('###aufgaben_ueberschrift###', $defaultClangId);
                     $log->logInfo('>> [INF] headline1 not found. using default: ' . $headline1);
                 } else {
                     $block1 = self::stripHeadline($block1);
                 }
             }
             if ($block2 != '') {
                 if ($headline2 == '') {
                     $headline2 = $xoutputFilter->get('###profil_ueberschrift###', $defaultClangId);
                     $log->logInfo('>> [INF] headline2 not found. using default: ' . $headline2);
                 } else {
                     $block2 = self::stripHeadline($block2);
                 }
             }
             if ($block3 != '') {
                 if ($headline3 == '') {
                     $headline3 = $xoutputFilter->get('###angebot_ueberschrift###', $defaultClangId);
                     $log->logInfo('>> [INF] headline3 not found. using default: ' . $headline3);
                 } else {
                     $block3 = self::stripHeadline($block3);
                 }
             }
             // add lang specific stuff for new job
             $log->logInfo('>> [INF] add lang specific stuff for new job');
             $sql2 = rex_sql::factory();
             $sql2->setDebug(HR4YOU_SYNC_DEBUG_MODE);
             rex_hr4you_sync_utils::logQuery($log, $sql2, 'INSERT INTO `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_stellen_lang` (stellen_id, clang_id, bezeichnung, aufgaben_ueberschrift, aufgaben_text, profil_ueberschrift, profil_text, angebot_ueberschrift, angebot_text, hr4you_einleitung) VALUES (' . $theJobId . ', ' . $defaultClangId . ', "' . $job->titel . '", "' . $headline1 . '", "' . htmlspecialchars($block1) . '", "' . $headline2 . '", "' . htmlspecialchars($block2) . '", "' . $headline3 . '", "' . htmlspecialchars($block3) . '", "' . $job->einleitung . '")');
         }
     }
     // delete pathlist as ids of jobs have changed
     $log->logInfo('>> [INF] delete pathlist');
     seo42_generate_pathlist(array());
     // restore vars and settings
     unset($REX['USER']);
     unset($I18N);
     ini_set('log_errors', $phpLogErrors);
     ini_set('error_log', $phperrorLog);
     $log->logInfo('======================================== END HR4YOU SYNC ========================================');
 }
Esempio n. 14
0
    public static function offline404ModeMsg($params)
    {
        global $REX, $I18N;
        if (!is_object($I18N)) {
            $I18N = rex_create_lang($REX['LANG']);
        }
        $I18N->appendFile($REX['INCLUDE_PATH'] . '/addons/seo42/lang/');
        $insert = '
			<!-- SEO42 Offline 404 Mode -->
			<style type="text/css">
				body { 
					position: relative;
				}

				#seo42-offline-404-frontend-msg { 
					font-family: Arial, sans-serif; 
					font-size: 13px; 
					color: white; 
					background: darkred;
					border: 1px solid #fff;
					position: fixed; 
					left: 0; 
					right: 0; 
					top: 0; 
					padding: 4px; 
					text-align: center;
					z-index: 100;
				}
			</style>
			<div id="seo42-offline-404-frontend-msg">' . $I18N->msg('seo42_offline_404_frontend_msg') . '</div>
			<!-- SEO42 Offline 404 Mode -->' . PHP_EOL;
        return str_replace('</body>', $insert . '</body>', $params['subject']);
    }
Esempio n. 15
0
// --------------------------------------------- END: SETUP FUNCTIONS
$MSG['err'] = '';
$checkmodus = rex_request('checkmodus', 'float');
$send = rex_request('send', 'string');
$dbanlegen = rex_request('dbanlegen', 'string');
$noadmin = rex_request('noadmin', 'string');
$lang = rex_request('lang', 'string');
$export_addon_dir = $REX['INCLUDE_PATH'] . '/addons/import_export';
require_once $export_addon_dir . '/functions/function_folder.inc.php';
require_once $export_addon_dir . '/functions/function_import_folder.inc.php';
require_once $export_addon_dir . '/functions/function_import_export.inc.php';
// ---------------------------------- MODUS 0 | Start
if (!($checkmodus > 0 && $checkmodus < 10)) {
    $langpath = $REX['INCLUDE_PATH'] . '/lang';
    foreach ($REX['LANGUAGES'] as $l) {
        $I18N_T = rex_create_lang($l, $langpath, false);
        $label = $I18N_T->msg('lang');
        $label .= ' (utf-8)';
        $langs[$l] = '<li><a href="index.php?checkmodus=0.5&amp;lang=' . $l . '"' . rex_tabindex() . '>' . $label . '</a></li>';
    }
    unset($I18N_T);
    // wenn nur eine Sprache -> direkte weiterleitung
    if (count($REX['LANGUAGES']) == 1) {
        header('Location: index.php?checkmodus=0.5&lang=' . key($langs));
        exit;
    }
    rex_setup_title('SETUP: SELECT LANGUAGE');
    echo '<h2 class="rex-hl2">Please choose a language!</h2>
                <div class="rex-area-content">
                    <ul class="rex-setup-language">' . implode('', $langs) . '</ul>
                </div>';
Esempio n. 16
0
 function a401_perform_ajax($_rex_ajax, $rxa, $REX)
 {
     $rxa['ajaxdir'] .= $REX['REDAXO'] ? 'backend/' : 'frontend/';
     if (!$REX['REDAXO'] and !$rxa['settings']['frontend_active']) {
         return;
     }
     if ($REX['REDAXO'] and !$rxa['settings']['backend_active']) {
         return;
     }
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $rxa['ajaxdir'] = str_replace("/", "\\", $rxa['ajaxdir']);
     }
     // Code ausführen falls die Datei vorhanden ist
     if (file_exists($rxa['ajaxdir'] . $_rex_ajax . '.inc.php')) {
         @ob_end_clean();
         @ob_end_clean();
         // Fix für REDAXO < 4.2.x
         if (isset($REX_ARTICLE)) {
             $REX['ARTICLE'] = $REX_ARTICLE;
         }
         // Include der Datei
         include_once $rxa['ajaxdir'] . $_rex_ajax . '.inc.php';
         exit;
     } else {
         if (trim($REX["ADDON"][$rxa['name']]["settings"]["errormail"]) != '') {
             $_subject = 'REX_Ajax Error ' . $REX['SERVER'] . ' ' . $REX['SERVERNAME'];
             $_mailtext = $_subject . "\n\n" . date('d.m.Y h:i:s') . "\n\n";
             ob_start();
             var_dump($_REQUEST);
             $_mailtext .= "_REQUEST\n";
             $_mailtext .= ob_get_contents();
             ob_end_clean();
             ob_start();
             var_dump($_SESSION);
             $_mailtext .= "\n_SESSION\n";
             $_mailtext .= ob_get_contents();
             ob_end_clean();
             ob_start();
             var_dump($_SERVER);
             $_mailtext .= "\n_SERVER\n";
             $_mailtext .= ob_get_contents();
             ob_end_clean();
             $_to = $REX["ADDON"][$rxa['name']]["settings"]["errormail"];
             $_header = 'From: ' . $REX['ERROR_EMAIL'] . "\r\n" . 'Reply-To: ' . $REX['ERROR_EMAIL'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
             if (OOAddon::isAvailable('phpmailer')) {
                 if (!isset($I18N)) {
                     $I18N = rex_create_lang($REX['LANG']);
                 }
                 include $REX['INCLUDE_PATH'] . '/addons/phpmailer/config.inc.php';
                 $mail = new rex_mailer();
                 $mail->From = $REX['ERROR_EMAIL'];
                 $mail->Subject = $_subject;
                 $mail->Body = $_mailtext;
                 $mail->AddAddress($_to, '');
                 $mail->Send();
             } else {
                 @mail($_to, $_subject, $_mailtext, $_header);
             }
         }
     }
 }
Esempio n. 17
0
 /**
  * @access public
  */
 function isInUse()
 {
     global $REX, $I18N;
     // Im Frontend gibts kein I18N
     if (!is_object($I18N)) {
         $I18N = rex_create_lang($REX['LANG']);
     }
     $sql = rex_sql::factory();
     $filename = addslashes($this->getFileName());
     $values = array();
     for ($i = 1; $i < 21; $i++) {
         // check if valueX contains $filename,
         // but take care that other files that end with $filename are not matched
         // example: "abc.jpg" should not be matched for $filename="bc.jpg"
         $values[] = 'value' . $i . ' REGEXP "(^|[^[:alnum:]+_-])' . $filename . '"';
     }
     $files = array();
     $filelists = array();
     for ($i = 1; $i < 11; $i++) {
         $files[] = 'file' . $i . '="' . $filename . '"';
         $filelists[] = 'FIND_IN_SET("' . $filename . '",filelist' . $i . ')';
     }
     $where = '';
     $where .= implode(' OR ', $files) . ' OR ';
     $where .= implode(' OR ', $filelists) . ' OR ';
     $where .= implode(' OR ', $values);
     $query = 'SELECT DISTINCT article_id, clang FROM ' . $REX['TABLE_PREFIX'] . 'article_slice WHERE ' . $where;
     $warning = array();
     $res = $sql->getArray($query);
     if ($sql->getRows() > 0) {
         $warning[0] = $I18N->msg('pool_file_in_use_articles') . '<br /><ul>';
         foreach ($res as $art_arr) {
             $aid = $art_arr['article_id'];
             $clang = $art_arr['clang'];
             $ooa = OOArticle::getArticleById($aid, $clang);
             $name = $ooa->getName();
             $warning[0] .= '<li><a href="javascript:openPage(\'index.php?page=content&amp;article_id=' . $aid . '&amp;mode=edit&amp;clang=' . $clang . '\')">' . $name . '</a></li>';
         }
         $warning[0] .= '</ul>';
     }
     // ----- EXTENSION POINT
     $warning = rex_register_extension_point('OOMEDIA_IS_IN_USE', $warning, array('filename' => $this->getFileName(), 'media' => $this));
     if (!empty($warning)) {
         return $warning;
     }
     return false;
 }
Esempio n. 18
0
    $REX['LANG'] = 'de_de';
    $I18N = rex_create_lang($REX['LANG']);
    $requestLang = rex_request('lang', 'string');
    foreach ($REX['LOCALES'] as $l) {
        if ($requestLang == $l) {
            $REX['LANG'] = $l;
            $I18N = rex_create_lang($REX['LANG']);
        }
    }
    setlocale(LC_ALL, trim($I18N->msg('setlocale')));
    header('Content-Type: text/html; charset=' . $I18N->msg('htmlcharset'));
    $page_name = $I18N->msg('setup');
    $page = 'setup';
} else {
    // ----------------- CREATE LANG OBJ
    $I18N = rex_create_lang($REX['LANG']);
    $locale = trim($I18N->msg('setlocale'));
    $charset = trim($I18N->msg('htmlcharset'));
    $charset_alt = str_replace('iso-', 'iso', $charset);
    setlocale(LC_ALL, $locale . '.' . $charset, $locale . '.' . $charset_alt, $locale);
    header('Content-Type: text/html; charset=' . $I18N->msg('htmlcharset'));
    header('Cache-Control: no-cache');
    header('Pragma: no-cache');
    // ---- prepare login
    $REX_LOGIN = new rex_backend_login($REX['TABLE_PREFIX'] . 'user');
    $REX_ULOGIN = rex_post('REX_ULOGIN', 'string');
    $REX_UPSW = rex_post('REX_UPSW', 'string');
    if ($REX['PSWFUNC'] != '') {
        $REX_LOGIN->setPasswordFunction($REX['PSWFUNC']);
    }
    if (isset($FORM['logout']) and $FORM['logout'] == 1) {
/**
 * Ändert den Status des Artikels
 *
 * @param int      $article_id Id des Artikels die gelöscht werden soll
 * @param int      $clang      Id der Sprache
 * @param int|null $status     Status auf den der Artikel gesetzt werden soll, oder NULL wenn zum nächsten Status weitergeschaltet werden soll
 *
 * @return array Ein Array welches den status sowie eine Fehlermeldung beinhaltet
 */
function rex_articleStatus($article_id, $clang, $status = null)
{
    global $REX, $I18N;
    if (!is_object($I18N)) {
        $I18N = rex_create_lang($REX['LANG']);
    }
    $success = false;
    $message = '';
    $artStatusTypes = rex_articleStatusTypes();
    $GA = rex_sql::factory();
    $GA->setQuery('select * from ' . $REX['TABLE_PREFIX'] . "article where id='{$article_id}' and clang={$clang}");
    if ($GA->getRows() == 1) {
        // Status wurde nicht von außen vorgegeben,
        // => zyklisch auf den nächsten Weiterschalten
        if (!$status) {
            $newstatus = ($GA->getValue('status') + 1) % count($artStatusTypes);
        } else {
            $newstatus = $status;
        }
        $EA = rex_sql::factory();
        $EA->setTable($REX['TABLE_PREFIX'] . 'article');
        $EA->setWhere("id='{$article_id}' and clang={$clang}");
        $EA->setValue('status', $newstatus);
        $EA->addGlobalUpdateFields($REX['REDAXO'] ? null : 'frontend');
        if (!$REX['REDAXO']) {
            include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_generate.inc.php';
        }
        if ($EA->update()) {
            $message = $I18N->msg('article_status_updated');
            rex_deleteCacheArticle($article_id, $clang);
            // ----- EXTENSION POINT
            $message = rex_register_extension_point('ART_STATUS', $message, array('id' => $article_id, 'clang' => $clang, 'status' => $newstatus));
            $success = true;
        } else {
            $message = $EA->getError();
        }
    } else {
        $message = $I18N->msg('no_such_category');
    }
    return array($success, $message);
}
Esempio n. 20
0
$MSG['err'] = "";
$checkmodus = rex_request('checkmodus', 'float');
$send = rex_request('send', 'string');
$dbanlegen = rex_request('dbanlegen', 'string');
$noadmin = rex_request('noadmin', 'string');
$export_addon_dir = $REX['INCLUDE_PATH'] . '/addons/import_export';
// ---------------------------------- MODUS 0 | Start
if (!($checkmodus > 0 && $checkmodus < 10)) {
    $langpath = $REX['INCLUDE_PATH'] . '/lang';
    $langs = array();
    if ($handle = opendir($langpath)) {
        while (false !== ($file = readdir($handle))) {
            if (substr($file, -5) == '.lang') {
                $isUtf8 = substr($file, -9) == 'utf8.lang';
                $locale = substr($file, 0, strlen($file) - strlen(substr($file, -5)));
                $I18N_T = rex_create_lang($locale, $langpath);
                $label = $I18N_T->msg('lang');
                if ($isUtf8) {
                    $label .= ' (utf-8)';
                }
                $langs[$locale] = '<li><a href="index.php?checkmodus=0.5&amp;lang=' . $locale . '"' . rex_tabindex() . '>' . $label . '</a></li>';
            }
        }
        closedir($handle);
        unset($I18N_T);
    }
    // wenn nur eine Sprache -> direkte weiterleitung
    if (count($langs) == 1) {
        header('Location: index.php?checkmodus=0.5&lang=' . key($langs));
        exit;
    }
 /**
  * @access public
  */
 function isInUse()
 {
     global $REX, $I18N;
     // Im Frontend gibts kein I18N
     if (!is_object($I18N)) {
         $I18N = rex_create_lang($REX['LANG']);
     }
     $sql = rex_sql::factory();
     $filename = addslashes($this->getFileName());
     $values = array();
     for ($i = 1; $i < 21; $i++) {
         $values[] = 'value' . $i . ' LIKE "%' . $filename . '%"';
     }
     $files = array();
     $filelists = array();
     for ($i = 1; $i < 11; $i++) {
         $files[] = 'file' . $i . '="' . $filename . '"';
         $filelists[] = '(filelist' . $i . ' = "' . $filename . '" OR filelist' . $i . ' LIKE "' . $filename . ',%" OR filelist' . $i . ' LIKE "%,' . $filename . ',%" OR filelist' . $i . ' LIKE "%,' . $filename . '" ) ';
     }
     $where = '';
     $where .= implode(' OR ', $files) . ' OR ';
     $where .= implode(' OR ', $filelists) . ' OR ';
     $where .= implode(' OR ', $values);
     $query = 'SELECT DISTINCT article_id, clang FROM ' . $REX['TABLE_PREFIX'] . 'article_slice WHERE ' . $where;
     // deprecated since REX 4.3
     // ----- EXTENSION POINT
     $query = rex_register_extension_point('OOMEDIA_IS_IN_USE_QUERY', $query, array('filename' => $this->getFileName(), 'media' => $this));
     $warning = array();
     $res = $sql->getArray($query);
     if ($sql->getRows() > 0) {
         $warning[0] = $I18N->msg('pool_file_in_use_articles') . '<br /><ul>';
         foreach ($res as $art_arr) {
             $aid = $art_arr['article_id'];
             $clang = $art_arr['clang'];
             $ooa = OOArticle::getArticleById($aid, $clang);
             $name = $ooa->getName();
             $warning[0] .= '<li><a href="javascript:openPage(\'index.php?page=content&amp;article_id=' . $aid . '&amp;mode=edit&amp;clang=' . $clang . '\')">' . $name . '</a></li>';
         }
         $warning[0] .= '</ul>';
     }
     // ----- EXTENSION POINT
     $warning = rex_register_extension_point('OOMEDIA_IS_IN_USE', $warning, array('filename' => $this->getFileName(), 'media' => $this));
     if (!empty($warning)) {
         return $warning;
     }
     return false;
 }