예제 #1
0
if (count($_GET) == 0) {
    util_redirect("http://wiki.dexonline.ro/wiki/Protocol_de_exportare_a_datelor");
}
$lastDump = getLastDumpDate($TODAY, $REMOTE_FOLDER);
SmartyWrap::assign('lastDump', $lastDump);
SmartyWrap::assign('url', $URL);
$lastClientUpdate = util_getRequestParameterWithDefault('last', '0');
if ($lastClientUpdate == '0') {
    // Dump the freshest full dump we have
    // TODO: return an error if there is no full dump
    SmartyWrap::assign('serveFullDump', true);
    $lastClientUpdate = $lastDump;
}
SmartyWrap::assign('diffs', getDiffsBetween($lastClientUpdate, $TODAY, $REMOTE_FOLDER));
header('Content-type: text/xml');
print SmartyWrap::fetch('xml/update4.tpl');
/**************************************************************************/
// Do not return a dump for today, in case it is still being built
function getLastDumpDate($today, $folder)
{
    global $STATIC_FILES;
    // Group existing files by date, excluding the diff files
    $map = array();
    foreach ($STATIC_FILES as $file) {
        $matches = array();
        if (preg_match(":^{$folder}/(\\d\\d\\d\\d-\\d\\d-\\d\\d)-[a-z]+.xml.gz:", $file, $matches)) {
            $date = $matches[1];
            if ($date < $today) {
                if (array_key_exists($date, $map)) {
                    $map[$date]++;
                } else {
예제 #2
0
if (count($_GET) == 0) {
    util_redirect("http://wiki.dexonline.ro/wiki/Protocol_de_exportare_a_datelor");
}
$lastDump = getLastDumpDate($TODAY, $REMOTE_FOLDER);
SmartyWrap::assign('lastDump', $lastDump);
SmartyWrap::assign('url', $URL);
$lastClientUpdate = util_getRequestParameterWithDefault('last', '0');
if ($lastClientUpdate == '0') {
    // Dump the freshest full dump we have
    // TODO: return an error if there is no full dump
    SmartyWrap::assign('serveFullDump', true);
    $lastClientUpdate = $lastDump;
}
SmartyWrap::assign('diffs', getDiffsBetween($lastClientUpdate, $TODAY, $REMOTE_FOLDER));
header('Content-type: text/xml');
print SmartyWrap::fetch('update4.ihtml');
/**************************************************************************/
// Do not return a dump for today, in case it is still being built
function getLastDumpDate($today, $folder)
{
    global $STATIC_FILES;
    // Group existing files by date, excluding the diff files
    $map = array();
    foreach ($STATIC_FILES as $file) {
        $matches = array();
        if (preg_match(":^{$folder}/(\\d\\d\\d\\d-\\d\\d-\\d\\d)-[a-z]+.xml.gz:", $file, $matches)) {
            $date = $matches[1];
            if ($date < $today) {
                if (array_key_exists($date, $map)) {
                    $map[$date]++;
                } else {
예제 #3
0
function dumpLexems($query, $remoteFile, $message)
{
    global $FTP;
    log_scriptLog($message);
    $results = db_execute($query);
    $tmpFile = tempnam(Config::get('global.tempDir'), 'xmldump_');
    $file = gzopen($tmpFile, 'wb9');
    gzwrite($file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    gzwrite($file, "<Lexems>\n");
    foreach ($results as $row) {
        $lexem = Model::factory('Lexem')->create($row);
        SmartyWrap::assign('lexem', $lexem);
        gzwrite($file, SmartyWrap::fetch('xml/xmldump/lexem.tpl'));
    }
    gzwrite($file, "</Lexems>\n");
    gzclose($file);
    $FTP->staticServerPut($tmpFile, $remoteFile);
    unlink($tmpFile);
}
예제 #4
0
$provider = util_getRequestParameter('provider');
// Display a banner for this provider
$go = util_getRequestParameter('go');
// Track a click and redirect to this provider
$clickurl = util_getRequestParameter('clickurl');
// Sent to us by OpenX; when displaying a banner, we have to link to this URL
if ($go) {
    $provider = $go;
    $go = true;
}
require_once "../phplib/ads/{$provider}/{$provider}AdsModule.php";
if ($provider == 'diverta') {
    $bookId = util_getRequestParameter('bookId');
    $book = DivertaBook::get_by_id($bookId);
    if (!$book) {
        exit;
    }
    if ($go) {
        $book->clicks++;
        $book->save();
        util_redirect($book->url);
    }
    $book->impressions++;
    $book->save();
    SmartyWrap::assign('book', $book);
    SmartyWrap::assign('hasImage', file_exists(util_getRootPath() . "wwwbase/img/diverta/thumb/{$book->sku}.jpg"));
}
SmartyWrap::assign('clickurl', str_replace('__', '&', $clickurl));
$output = SmartyWrap::fetch("ads/{$provider}.ihtml");
$output = addslashes(str_replace("\n", ' ', $output));
print "document.write(\"{$output}\");";
예제 #5
0
            case 3:
                $subject = 'cel târziu mâine';
                break;
            default:
                $subject = sprintf("în %s zile", $days - 1);
        }
        $subject = 'Cuvântul zilei: acțiune necesară ' . $subject;
        $mailTo = array_merge($rcptInfo, $rcptError);
    } else {
        $subject = 'Cuvântul zilei: notă informativă';
        $mailTo = $rcptInfo;
    }
    $mailTo = implode(', ', $mailTo);
    SmartyWrap::assign('numDays', NUM_DAYS);
    SmartyWrap::assign('messages', $messages);
    $body = SmartyWrap::fetch('email/checkWotd.tpl');
    if ($sendEmail) {
        log_scriptLog("checkWotd: sending email");
        mail($mailTo, $subject, $body, implode("\r\n", $MAIL_HEADERS));
    } else {
        if (!$quiet) {
            print "---- DRY RUN ----\n";
            print "Către: {$mailTo}\nSubiect: {$subject}\n\n{$body}\n";
        }
    }
    log_scriptLog("checkWotd: ending");
}
/*********************************************************************/
function addError($date, $text)
{
    global $firstErrorDate;
예제 #6
0
        $item = array();
        $ts = strtotime($w->displayDate);
        $defId = WordOfTheDayRel::getRefId($w->id);
        $def = Model::factory('Definition')->where('id', $defId)->where('status', ST_ACTIVE)->find_one();
        $source = Model::factory('Source')->where('id', $def->sourceId)->find_one();
        SmartyWrap::assign('def', $def);
        SmartyWrap::assign('source', $source);
        SmartyWrap::assign('imageUrl', $w->getImageUrl());
        if ($type == 'blog') {
            $curDate = strftime("%e %B", $ts);
            SmartyWrap::assign('curDate', $curDate);
            $item['title'] = "{$curDate} – " . $def->lexicon;
            $item['description'] = SmartyWrap::fetch('bits/wotdRssBlogItem.ihtml');
        } else {
            $item['title'] = $def->lexicon;
            $item['description'] = SmartyWrap::fetch('bits/wotdRssItem.ihtml');
        }
        $item['pubDate'] = date('D, d M Y H:i:s', $ts) . ' EEST';
        $item['link'] = util_getFullServerUrl() . 'cuvantul-zilei/' . date('Y/m/d', $ts);
        $results[] = $item;
    }
    header("Content-type: application/rss+xml");
    SmartyWrap::assign('rss_title', 'Cuvântul zilei');
    SmartyWrap::assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/cuvantul-zilei/');
    SmartyWrap::assign('rss_description', 'Doza zilnică de cuvinte de la DEXonline!');
    SmartyWrap::assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST');
    SmartyWrap::assign('results', $results);
    SmartyWrap::displayWithoutSkin('rss.ixml');
    exit;
}
$today = date('Y-m-d', time());
예제 #7
0
 static function getDebugInfo()
 {
     $data = DebugInfo::getDebugInfo();
     if (!$data['enabled']) {
         return '';
     }
     SmartyWrap::assign('debug_messages', $data['messages']);
     SmartyWrap::assign('debug_runningTimeMillis', $data['runningTimeMillis']);
     SmartyWrap::assign('debug_ormQueryLog', $data['ormQueryLog']);
     return SmartyWrap::fetch('bits/debugInfo.ihtml');
 }
예제 #8
0
SmartyWrap::assign('identity', $identity);
SmartyWrap::assign('email', $email);
SmartyWrap::assign('page_title', 'Parolă uitată');
SmartyWrap::assign('suggestHiddenSearchForm', true);
if ($submitButton) {
    if (!$email) {
        FlashMessage::add('Trebuie să introduceți o adresă de e-mail.');
        SmartyWrap::display('auth/parola-uitata.ihtml');
    } else {
        $user = User::get_by_email($email);
        if ($user) {
            log_userLog("Password recovery requested for {$email} from " . $_SERVER['REMOTE_ADDR']);
            // Create the token
            $pt = Model::factory('PasswordToken')->create();
            $pt->userId = $user->id;
            $pt->token = util_randomCapitalLetterString(20);
            $pt->save();
            // Send email
            SmartyWrap::assign('homePage', util_getFullServerUrl());
            SmartyWrap::assign('token', $pt->token);
            $body = SmartyWrap::fetch('email/resetPassword.ihtml');
            $ourEmail = Config::get('global.contact');
            $headers = array("From: DEX online <{$ourEmail}>", "Reply-To: {$ourEmail}", 'Content-Type: text/plain; charset=UTF-8');
            $result = mail($email, "Schimbarea parolei pentru DEX online", $body, implode("\r\n", $headers));
        }
        // Display a confirmation even for incorrect addresses.
        SmartyWrap::display('auth/passwordRecoveryEmailSent.ihtml');
    }
} else {
    SmartyWrap::display('auth/parola-uitata.ihtml');
}
예제 #9
0
파일: index.php 프로젝트: klimjr/cms
 if ((int) Text::get_get('localization') == 1) {
     echo json_encode($router::getLocalize());
     exit;
 }
 // Получение шаблона с формой
 if (Text::get_get('do') == 'get_form') {
     $form = Text::get_get('form');
     $user_id = (int) Text::get_get('user_id');
     $user_id = $user_id > 0 ? $user_id : isset($_SESSION['siteuser']['id']) ? $_SESSION['siteuser']['id'] : 0;
     $tpl = $oSettings::getSmarty_template() . 'forms/' . $form . '_form.tpl';
     $data = '';
     if (file_exists($tpl)) {
         $__lang = $router::getLocalize();
         $smarty->assign('__lang', $__lang);
         $smarty->assign('user_id', $user_id);
         $content = $smarty->fetch($tpl);
         $data = array('head' => isset($__lang['add_' . $form]) ? $__lang['add_' . $form] : '', 'content' => $content, 'success' => isset($__lang['add_' . $form . '_success']) ? $__lang['add_' . $form . '_success'] : '', 'error' => isset($__lang['add_' . $form . '_error']) ? $__lang['add_' . $form . '_error'] : '');
         echo json_encode($data);
     }
     exit;
 }
 // Определение мобильного устройства
 require_once DOC . 'system/php-to-detect-mobile-phones.php';
 $mobile = detect_mobile_device() ? 1 : 0;
 if (isset($aStrings[1]) && $aStrings[1] == 'mebel') {
     $smarty->assign(array('body_class' => 'poliform_black'));
 }
 // Выгрузка переменных в шаблон
 $smarty->assign(array('template' => System_Settings::getSmarty_templateName(), 'this_url' => $this_url, 'langs' => $langs, 'current_lang' => $current_lang, 'default_lang' => $default_lang, '__lang' => $router::getLocalize(), 'mobile' => $mobile, 'options' => $options, 'user' => isset($_SESSION['siteuser']) ? $_SESSION['siteuser'] : array()));
 // Вывод страницы с логином для незарегистрированных пользователей
 /*