Beispiel #1
0
 // check if seopage/urlpage needs to be enabled
 if (!$REX['ADDON']['seo42']['settings']['one_page_mode'] || $REX['ADDON']['seo42']['settings']['one_page_mode'] && $REX['ARTICLE_ID'] == $REX['START_ARTICLE_ID']) {
     if (isset($REX['USER']) && $REX['USER']->isAdmin()) {
         // admins get everything :)
         if (!$REX['ADDON']['seo42']['settings']['one_page_mode']) {
             // url page not needed when in one page mode
             seo42_utils::enableURLPage();
             // injection order is important
         }
         seo42_utils::enableSEOPage();
     } else {
         if (isset($REX['USER']) && $REX['USER']->hasPerm('seo42[url_default]')) {
             seo42_utils::enableURLPage();
         }
         if (isset($REX['USER']) && ($REX['USER']->hasPerm('seo42[seo_default]') || $REX['USER']->hasPerm('seo42[seo_extended]') || $REX['USER']->hasPerm('editContentOnly[]'))) {
             seo42_utils::enableSEOPage();
         }
     }
 }
 // fix article preview link as othewise not url types will show correct preview url
 rex_register_extension('PAGE_CONTENT_MENU', 'seo42_utils::fixArticlePreviewLink');
 // check for missing db fields after db import
 if (!$REX['SETUP']) {
     rex_register_extension('A1_AFTER_DB_IMPORT', 'seo42_utils::afterDBImport');
 }
 // if clang is added/deleted show message to the user that he should check his lang settings
 rex_register_extension('CLANG_ADDED', 'seo42_utils::showMsgAfterClangModified');
 rex_register_extension('CLANG_DELETED', 'seo42_utils::showMsgAfterClangModified');
 rex_register_extension('CLANG_UPDATED', 'seo42_utils::showMsgAfterClangModified');
 // don't clone seo data when new clang is added
 rex_register_extension('CLANG_ADDED', 'seo42_utils::emptySEODataAfterClangAdded');
Beispiel #2
0
    echo $I18N->msg('seo42_urlpage_url_clone');
    ?>
</label>
							</p>
						</div>
						<?php 
} else {
    ?>
						<?php 
    $sql = rex_sql::factory();
    //$sql->debugsql = 1;
    $urlDataStartClang = $sql->getArray('SELECT seo_custom_url FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE id=' . $REX['ARTICLE_ID'] . ' AND clang=' . $REX['START_CLANG_ID']);
    $urlFieldStartClang = $urlDataStartClang[0]['seo_custom_url'];
    $cloneCheckedStartClang = false;
    if ($urlFieldStartClang != '') {
        $urlDataStartClang = seo42_utils::getUrlTypeData($urlFieldStartClang);
        $jsonDataStartClang = json_decode($urlDataStartClang, true);
        if (isset($jsonDataStartClang['url_clone']) && $jsonDataStartClang['url_clone']) {
            $cloneCheckedStartClang = true;
        }
    }
    if ($cloneCheckedStartClang == true && !isset($jsonData['url_type']) || isset($jsonData['url_type']) && $jsonData['url_type'] == SEO42_URL_TYPE_DEFAULT) {
        ?>
							<div class="rex-form-row">
								<p class="rex-form-col-a rex-form-read">
									<label for="document_id_visible"><?php 
        echo $I18N->msg('seo42_urlpage_lang_clone_hint');
        ?>
</label>
									<span class="rex-form-read" id="document_id_visible"><?php 
        echo $I18N->msg('seo42_urlpage_lang_clone_hint_msg', $REX['CLANG'][$REX['START_CLANG_ID']]);
Beispiel #3
0
<?php

$search = array('(CHANGELOG.md)', '(LICENSE.md)', '(FAQ.md)', '(UPDATE.md)');
$replace = array('(index.php?page=seo42&subpage=help&chapter=changelog)', '(index.php?page=seo42&subpage=help&chapter=license)', '(index.php?page=seo42&subpage=help&chapter=faq)', '(index.php?page=seo42&subpage=help&chapter=update)');
echo seo42_utils::getHtmlFromMDFile('README.md', $search, $replace);
Beispiel #4
0
<?php

echo seo42_utils::getHtmlFromMDFile('UPDATE.md');
Beispiel #5
0
<?php

echo seo42_utils::getHtmlFromMDFile('CHANGELOG.md');
Beispiel #6
0
<?php

$sql = new rex_sql();
//$sql->debugsql = true;
// rex_article
$sql->setQuery('ALTER TABLE `' . $REX['TABLE_PREFIX'] . 'article` DROP `seo_title`, DROP `seo_description`, DROP `seo_keywords`, DROP `seo_custom_url`, DROP `seo_canonical_url`, DROP `seo_noindex`, DROP `seo_ignore_prefix`');
// rex_redirects
$sql->setQuery('DROP TABLE IF EXISTS `' . $REX['TABLE_PREFIX'] . 'redirects`');
// remove data dir for addon
seo42_utils::rrmdir(SEO42_DATA_DIR);
rex_generateAll();
$REX['ADDON']['install']['seo42'] = 0;
Beispiel #7
0
$I18N->appendFile($REX['INCLUDE_PATH'] . '/addons/seo42/lang/');
// includes
require_once $REX['INCLUDE_PATH'] . '/addons/seo42/classes/class.seo42_utils.inc.php';
// check redaxo version
if (version_compare($REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.' . $REX['MINORVERSION'], '4.4.1', '<=')) {
    $error[] = $I18N->msg('seo42_install_rex_version');
}
// check for concurrent addons
$disable_addons = array('url_rewrite', 'yrewrite', 'rexseo', 'rexseo42', 'resource_includer');
foreach ($disable_addons as $a) {
    if (OOAddon::isInstalled($a) || OOAddon::isAvailable($a)) {
        $error[] = $I18N->msg('seo42_install_concurrent') . ' ' . $a;
    }
}
// auto install plugins
$returnmsg = seo42_utils::autoInstallPlugins('seo42', array());
// no plugins yet to auto install
if ($returnmsg != '') {
    $error[] = $returnmsg;
}
// setup seo db fields
if (count($error) == 0) {
    $sql = new rex_sql();
    //$sql->debugsql = true;
    // IMPORTANT: if adding/removing db fields here, check also for uninstall.inc.php and seo42_utils::afterDBImport() and seo42::emptySEODataAfterClangAdded()
    $sql->setQuery('ALTER TABLE `' . $REX['TABLE_PREFIX'] . 'article` ADD `seo_title` TEXT, ADD `seo_description` TEXT, ADD `seo_keywords` TEXT, ADD `seo_custom_url` TEXT, ADD `seo_canonical_url` TEXT, ADD `seo_noindex` VARCHAR(1), ADD `seo_ignore_prefix` VARCHAR(1)');
    // redirects
    $sql->setQuery("\n\t\tCREATE TABLE IF NOT EXISTS `" . $REX['TABLE_PREFIX'] . "redirects` (\n\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t`source_url` varchar(255) NOT NULL,\n\t\t`target_url` varchar(255) NOT NULL,\n\t\tPRIMARY KEY (`id`)\n\t);");
    // redirects extras (SEO42 4.2.0+)
    $sql->setQuery('ALTER TABLE `' . $REX['TABLE_PREFIX'] . 'redirects` ADD `create_date` DATETIME, ADD `expire_date` DATETIME');
    // delete cache
Beispiel #8
0
<?php

echo seo42_utils::getHtmlFromMDFile('FAQ.md');
Beispiel #9
0
}
if (rex_post('saveseo', 'boolean')) {
    $sql = rex_sql::factory();
    $sql->setTable($REX['TABLE_PREFIX'] . "article");
    //$sql->debugsql = 1;
    $sql->setWhere("id=" . $articleID . " AND clang=" . $clang);
    //sanitize
    $title = seo42_utils::sanitizeString(rex_post('seo_title'));
    $description = seo42_utils::sanitizeString(rex_post('seo_description'));
    $keywords = str_replace(' , ', ',', rex_post('seo_keywords'));
    $keywords = str_replace(',', ', ', $keywords);
    // always have a whitespace char after comma
    $keywords = trim($keywords, " ,");
    $keywords = strtolower(seo42_utils::sanitizeString($keywords));
    // also keywords should be all lowercase
    $canonicalUrl = seo42_utils::sanitizeString(rex_post('seo_canonical_url'));
    // seo fields
    $sql->setValue('seo_title', $title);
    $sql->setValue('seo_description', $description);
    $sql->setValue('seo_keywords', $keywords);
    $sql->setValue('seo_canonical_url', $canonicalUrl);
    // ignore prefix
    $ignorePrefix = rex_post('seo_ignore_prefix');
    if (is_array($ignorePrefix)) {
        $sql->setValue('seo_ignore_prefix', '1');
    } else {
        $sql->setValue('seo_ignore_prefix', '');
    }
    // no index
    $noIndex = rex_post('seo_noindex');
    if (is_array($noIndex)) {
Beispiel #10
0
	<fieldset class="rex-form-col-1">
      <legend><?php 
echo $I18N->msg('seo42_settings_download_section');
?>
</legend>
      <div class="rex-form-wrapper slide">


		<div class="rex-form-row rex-form-element-v1">
				<p class="rex-form-text">
					<label for="force_download_for_filetypes"><?php 
echo $I18N->msg('seo42_settings_force_download_for_filetypes');
?>
</label>
					<input type="text" value="<?php 
echo seo42_utils::implodeArray($REX['ADDON']['seo42']['settings']['force_download_for_filetypes']);
?>
" name="settings[force_download_for_filetypes]" class="rex-form-text tags" id="force_download_for_filetypes">
				</p>
			</div>

		</div>
       </fieldset>



      <fieldset class="rex-form-col-1">
        <legend><?php 
echo $I18N->msg('seo42_settings_header_section');
?>
</legend>
 /**
  * REWRITE()
  *
  * rewrite URL
  * @param $params from EP URL_REWRITE
  */
 function rewrite($params)
 {
     // URL ALREADY SET BY OTHER EXTENSION
     if ($params['subject'] != '') {
         return $params['subject'];
     }
     // EP "SEO42_PRE_REWRITE"
     $url = rex_register_extension_point('SEO42_PRE_REWRITE', false, $params);
     if ($url !== false) {
         return $url;
     }
     global $REX, $SEO42_IDS;
     $id = $params['id'];
     $name = $params['name'];
     $clang = $params['clang'];
     $subdir = '';
     // 42 | $REX['ADDON']['seo42']['settings']['install_subdir']
     $notfound_id = $REX['NOTFOUND_ARTICLE_ID'];
     // GET PARAMS STRING
     $urlparams = self::makeUrlParams($params);
     // GET URL FROM PATHLIST AND APPEND PARAMS
     if (isset($SEO42_IDS[$id]) && isset($SEO42_IDS[$id][$clang])) {
         $base_url = $SEO42_IDS[$id][$clang]['url'];
         $url = $base_url . $urlparams;
         $notfound = false;
     } else {
         // RexDude
         $url = '';
         $base_url = '';
         if (!empty($SEO42_IDS)) {
             if (!isset($SEO42_IDS[$notfound_id][$clang]['url'])) {
                 $clang = $REX['START_CLANG_ID'];
             }
             $url = $base_url = $SEO42_IDS[$notfound_id][$clang]['url'];
         }
         $notfound = true;
     }
     // URL START
     // 42
     if ($REX['REDAXO'] && !(rex_request('page', 'string') == 'seo42' && rex_request('subpage', 'string') == 'help')) {
         // for seo42 debug page urls should look like in frontend
         $subdir = '';
     } else {
         $subdir = seo42::getUrlStart() . $subdir;
     }
     // HACK: EP URL_REWRITE WON'T ACCEPT EMPTY STRING AS RETURN
     if ($subdir == '' && $url == '') {
         $url = ' ';
     }
     // str_replace fixes a caching bug that appears while updating specific
     // modules/slices in the redaxo backend
     $url = str_replace('/redaxo/', '/', $subdir . $url);
     // retrieve trimmend url
     $trimmedUrl = seo42::trimUrl($url);
     // external urls / javascript urls etc. so we have to remove the url start string
     if (!seo42_utils::isInternalCustomUrl($trimmedUrl)) {
         $url = $trimmedUrl;
     }
     // EP "SEO42_POST_REWRITE"
     $ep_params = array('article_id' => $id, 'clang' => $clang, 'notfound' => $notfound, 'base_url' => $base_url, 'subdir' => $subdir, 'urlparams' => $urlparams, 'params' => $params['params'], 'divider' => $params['divider']);
     $url = rex_register_extension_point('SEO42_POST_REWRITE', $url, $ep_params);
     return $url;
 }
Beispiel #12
0
<?php

echo seo42_utils::getHtmlFromMDFile('STARTGUIDE.md');
Beispiel #13
0
    public static function getDebugInfo($articleId = 0)
    {
        global $I18N, $REX;
        if ($articleId != 0) {
            self::initArticle($articleId);
        }
        if (!OOArticle::isValid(self::$curArticle)) {
            return '';
        }
        $out = '<div id="seo42-debug">';
        $out .= '<h1>---------- SEO42 DEBUG BEGIN ----------<h1>';
        // general information
        $out .= '<h2>General Information</h2>';
        $out .= '<table>';
        $out .= '<tr><td class="left"><code>REDAXO Version</code></td><td class="right"><code>' . $REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.' . $REX['MINORVERSION'] . '</code></td></tr>';
        $out .= '<tr><td class="left"><code>SEO42 Version</code></td><td class="right"><code>' . $REX['ADDON']['version']['seo42'] . '</code></td></tr>';
        $out .= '<tr><td class="left"><code>PHP Version</code></td><td class="right"><code>' . phpversion() . '</code></td></tr>';
        if (isset($REX['ADDON']['version']['community'])) {
            $out .= '<tr><td class="left"><code>Community Version</code></td><td class="right"><code>' . $REX['ADDON']['version']['community'] . '</code></td></tr>';
        }
        $out .= '</table>';
        // methods
        $out .= '<h2>Class Methods</h2>';
        $out .= '<table>';
        $out .= self::getDebugInfoRow('rex_getUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getTrimmedUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getFullUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getTitle');
        $out .= self::getDebugInfoRow('seo42::getTitlePart');
        $out .= self::getDebugInfoRow('seo42::getDescription');
        $out .= self::getDebugInfoRow('seo42::getKeywords');
        $out .= self::getDebugInfoRow('seo42::getRobotRules');
        $out .= self::getDebugInfoRow('seo42::getCanonicalUrl');
        $out .= self::getDebugInfoRow('seo42::getArticleName');
        $out .= self::getDebugInfoRow('seo42::isStartArticle');
        $out .= self::getDebugInfoRow('seo42::getWebsiteName');
        $out .= self::getDebugInfoRow('seo42::getLangCode', array('0'));
        $out .= self::getDebugInfoRow('seo42::getLangSlug', array('0'));
        $out .= self::getDebugInfoRow('seo42::getLangName', array('0'));
        $out .= self::getDebugInfoRow('seo42::getOriginalLangName', array('0'));
        $out .= self::getDebugInfoRow('seo42::getServerProtocol');
        $out .= self::getDebugInfoRow('seo42::getBaseUrl');
        $out .= self::getDebugInfoRow('seo42::getServerUrl');
        $out .= self::getDebugInfoRow('seo42::getServer');
        $out .= self::getDebugInfoRow('seo42::getServerWithSubDir');
        $out .= self::getDebugInfoRow('seo42::getServerSubDir');
        $out .= self::getDebugInfoRow('seo42::isWwwServerUrl');
        $out .= self::getDebugInfoRow('seo42::hasTemplateBaseTag');
        $out .= self::getDebugInfoRow('seo42::isSubDirInstall');
        $out .= self::getDebugInfoRow('seo42::isMultiLangInstall');
        $out .= self::getDebugInfoRow('seo42::getLangCount');
        $out .= self::getDebugInfoRow('seo42::getTitleDelimiter');
        $out .= self::getDebugInfoRow('seo42::getUrlStart');
        $out .= self::getDebugInfoRow('seo42::has404ResponseFlag');
        $out .= self::getDebugInfoRow('seo42::getQueryString');
        $out .= self::getDebugInfoRow('seo42::getMediaDir');
        $out .= self::getDebugInfoRow('seo42::getMediaDirName');
        $out .= self::getDebugInfoRow('seo42::getMediaFile', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getMediaUrl', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getAbsoluteMediaFile', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getMediaAddonDir');
        $out .= self::getDebugInfoRow('seo42::getLangTags');
        $out .= self::getDebugInfoRow('seo42::getHtml');
        $out .= self::getDebugInfoRow('seo42::getImageTag', array('image.png', 'rex_mediapool_detail', '150', '100'));
        $out .= self::getDebugInfoRow('seo42::getImageManagerFile', array('image.png', 'rex_mediapool_detail'));
        $out .= self::getDebugInfoRow('seo42::getDownloadFile', array('doc.pdf'));
        $out .= self::getDebugInfoRow('seo42::getUrlString', array("The Hitchhiker's Guide to the Galaxy!"));
        $out .= self::getDebugInfoRow('seo42::getAnswer');
        $out .= '</table>';
        // settings
        $out .= '<h2>Settings</h2>';
        $out .= '<pre class="rex-code">';
        $out .= seo42_utils::print_r_pretty($REX['ADDON']['seo42']['settings'], true);
        $out .= '</pre>';
        // cached redirects
        $out .= '<h2>Cached Redirects</h2>';
        $out .= '<pre class="rex-code">';
        $out .= seo42_utils::print_r_pretty($REX['SEO42_CACHED_REDIRECTS'], true);
        $out .= '</pre>';
        // pathlist
        $out .= '<h2>Pathlist</h2>';
        $pathlistRoot = SEO42_PATHLIST;
        if (file_exists($pathlistRoot)) {
            $content = rex_get_file_contents($pathlistRoot);
            $out .= rex_highlight_string($content, true);
        } else {
            $out .= 'File not found: ' . $pathlistRoot;
        }
        // .htaccess
        $out .= '<h2>.htaccess</h2>';
        $htaccessRoot = $REX['FRONTEND_PATH'] . '/.htaccess';
        if (file_exists($htaccessRoot)) {
            $content = rex_get_file_contents($htaccessRoot);
            $out .= rex_highlight_string($content, true);
        } else {
            $out .= 'File not found: ' . $htaccessRoot;
        }
        $out .= '<h1>---------- SEO42 DEBUG END ----------</h1>';
        $out .= '</div>';
        $out .= '<style type="text/css">
					#seo42-debug h1 {
						font-size: 16px;
						margin: 10px 0;
					}

					#seo42-debug h2 {
						margin: 15px 0;
						font-size: 14px;
					}

					#seo42-debug .rex-code {
						border: 1px solid #F2353A;
					}

					#seo42-debug code,
					#seo42-debug .rex-code {
						color: #000;
						background: #FAF9F5;
					}

					#seo42-debug table {
						width: 100%;
						border-collapse: collapse;
						border-spacing: 0;
						background: #FAF9F5;
					}

					#seo42-debug table th,
					#seo42-debug table thead td {
						font-weight: bold;
					}

					#seo42-debug table td, 
					#seo42-debug table th {
						padding: 12px;
						border: 1px solid #F2353A;
						text-align: left;
					}

					#seo42-debug table td.left {
						width: 280px;
					}
				</style>';
        return $out;
    }
Beispiel #14
0
<?php

echo seo42_utils::getHtmlFromMDFile('LICENSE.md');
Beispiel #15
0
 if ($func == 'edit') {
     $formLabel = $I18N->msg('seo42_redirect_redirect_edit');
 } elseif ($func == 'add') {
     $formLabel = $I18N->msg('seo42_redirect_redirect_add');
 }
 $form = rex_form::factory($REX['TABLE_PREFIX'] . 'redirects', $formLabel, 'id=' . $redirect_id);
 $form->addErrorMessage(REX_FORM_ERROR_VIOLATE_UNIQUE_KEY, $I18N->msg('seo42_redirect_redirect_exists'));
 // source url
 $field =& $form->addTextField('source_url');
 $field->setLabel($I18N->msg('seo42_redirect_source_url'));
 $field->setAttribute('id', 'source-url');
 // target url
 $field =& $form->addTextField('target_url');
 $field->setLabel($I18N->msg('seo42_redirect_target_url'));
 $field->setAttribute('id', 'target-url');
 if (seo42_utils::redirectsDoExpire() && $func == 'edit') {
     $field =& $form->addReadOnlyField('create_date');
     $field->setLabel($I18N->msg('seo42_redirect_create_date'));
     $field =& $form->addTextField('expire_date');
     $field->setLabel($I18N->msg('seo42_redirect_expire_date'));
 }
 if ($func == 'edit') {
     $form->addParam('redirect_id', $redirect_id);
 } elseif ($func == 'add') {
     // do nothing
 }
 // sort params to keep sort settings of user in list mode
 if (rex_request('sort') != '') {
     $form->addParam('sort', rex_request('sort'));
 }
 if (rex_request('sorttype') != '') {
 public static function syncRedirects()
 {
     global $REX, $SEO42_IDS, $SEO42_IDS_CLONE, $SEO42_URLS, $SEO42_URLS_CLONE;
     $newRedirects = array();
     seo42_generate_pathlist(array());
     // normal urls with existing article_id
     foreach ($SEO42_IDS as $id => $value) {
         if (isset($SEO42_IDS_CLONE[$id])) {
             foreach ($REX['CLANG'] as $clangId => $clangName) {
                 $oldUrl = '/' . $SEO42_IDS_CLONE[$id][$clangId]['url'];
                 $newUrl = '/' . $SEO42_IDS[$id][$clangId]['url'];
                 if ($oldUrl !== $newUrl) {
                     if ($oldUrl == '/' || $oldUrl == '' || $newUrl == '' || $oldUrl == $newUrl) {
                         // do nothing
                     } else {
                         $article = OOArticle::getArticleById($id, $clangId);
                         if (is_object($article)) {
                             $onlyOnline = $REX['ADDON']['seo42']['settings']['sync_redirects_only_online'];
                             if (!$onlyOnline || $onlyOnline && $article->isOnline()) {
                                 $newRedirects[$oldUrl] = $newUrl;
                             }
                         }
                     }
                 }
             }
         }
     }
     // userdef urls
     $userDefOldUrls = self::getUserDefUrls($SEO42_URLS_CLONE);
     if (isset($userDefOldUrls) && is_array($userDefOldUrls) && count($userDefOldUrls) > 0) {
         // include pathlist manually because at this point userdef urls are missing in $SEO42_URLS array
         if (file_exists(SEO42_PATHLIST)) {
             unset($SEO42_URLS);
             unset($SEO42_IDS);
             include SEO42_PATHLIST;
         }
         $userDefNewUrls = self::getUserDefUrls($SEO42_URLS);
         foreach ($userDefNewUrls as $id => $data) {
             if (isset($userDefOldUrls[$id])) {
                 $oldUrl = '/' . $userDefOldUrls[$id]['url'];
                 $newUrl = '/' . $userDefNewUrls[$id]['url'];
                 if ($oldUrl !== $newUrl) {
                     if ($oldUrl == '/' || $oldUrl == '' || $newUrl == '' || $oldUrl == $newUrl) {
                         // do nothing
                     } else {
                         $article = OOArticle::getArticleById($data['article_id'], $data['clang']);
                         if (is_object($article)) {
                             $onlyOnline = $REX['ADDON']['seo42']['settings']['sync_redirects_only_online'];
                             if (!isset($newRedirects[$oldUrl])) {
                                 if (!$onlyOnline || $onlyOnline && $article->isOnline()) {
                                     $newRedirects[$oldUrl] = $newUrl;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (count($newRedirects) > 0) {
         foreach ($newRedirects as $oldUrl => $newUrl) {
             // check for redirects loop
             $sql = rex_sql::factory();
             $sql->setDebug(false);
             $sql->setQuery("SELECT * FROM `" . $REX['TABLE_PREFIX'] . "redirects` WHERE source_url LIKE '" . self::sqlLike($newUrl) . "' ESCAPE '|'");
             if ($sql->getRows() > 0) {
                 // delete existing redirect to avoid loop
                 $sql2 = rex_sql::factory();
                 $sql2->setDebug(false);
                 $sql2->setQuery("DELETE FROM `" . $REX['TABLE_PREFIX'] . "redirects` WHERE source_url LIKE '" . self::sqlLike($newUrl) . "' ESCAPE '|'");
             } else {
                 $maxAge = intval($REX['ADDON']['seo42']['settings']['redirects_max_age']);
                 $createDate = self::getDate();
                 $expireDate = self::getDate($maxAge);
                 if (!seo42_utils::redirectsDoExpire()) {
                     $expireDate = 0;
                 }
                 // check if redirect already exists
                 $sql2 = rex_sql::factory();
                 $sql2->setDebug(false);
                 $sql2->setQuery("SELECT * FROM `" . $REX['TABLE_PREFIX'] . "redirects` WHERE source_url LIKE '" . self::sqlLike($oldUrl) . "' ESCAPE '|'");
                 if ($sql2->getRows() > 0) {
                     // update existing redirect
                     $sql3 = rex_sql::factory();
                     $sql3->setDebug(false);
                     $sql3->setQuery('UPDATE `' . $REX['TABLE_PREFIX'] . 'redirects` SET source_url = "' . $oldUrl . '", target_url = "' . $newUrl . '", create_date = "' . $createDate . '", expire_date = "' . $expireDate . '" WHERE id = ' . $sql2->getValue('id'));
                 } else {
                     // add new redirect
                     $sql3 = rex_sql::factory();
                     $sql3->setDebug(false);
                     $sql3->setQuery('INSERT INTO `' . $REX['TABLE_PREFIX'] . 'redirects` (source_url, target_url, create_date, expire_date) VALUES ("' . $oldUrl . '", "' . $newUrl . '", "' . $createDate . '", "' . $expireDate . '")');
                 }
             }
         }
         // update cached redirects
         self::updateRedirectsFile(false);
     }
 }
Beispiel #17
0
<?php

require $REX['INCLUDE_PATH'] . '/addons/seo42/classes/class.seo42_tool.inc.php';
require $REX['INCLUDE_PATH'] . '/addons/seo42/classes/class.seo42_tool_manager.inc.php';
$func = rex_request('func', 'string');
if ($func == 'add_domain') {
    $REX['ADDON']['seo42']['settings']['pagerank_checker_unlock'] = true;
    seo42_utils::updateSettingsFile();
}
$googleIndexLink = 'https://www.google.com/search?q=site:' . seo42::getServerWithSubDir();
?>

<?php 
if ($REX['ADDON']['seo42']['settings']['pagerank_checker']) {
    ?>
<div class="rex-addon-output">
	<h2 class="rex-hl2"><?php 
    echo $I18N->msg('seo42_pr_tool');
    ?>
</h2>
	<div class="rex-area-content">
		<div class="tool-icon"></div>
		<p><?php 
    echo $I18N->msg('seo42_pr_tool_msg') . ' ' . seo42::getServerWithSubdir();
    ?>
.</p>
		<p class="pr"><?php 
    echo $I18N->msg('seo42_pr_tool_pagerank');
    ?>
: <span id="pagerank" class="info"><?php 
    if ($REX['ADDON']['seo42']['settings']['pagerank_checker_unlock']) {
Beispiel #18
0
</h2>
	<div class="rex-area-content">
		<p><?php 
echo $I18N->msg('seo42_setup_step2_msg1');
?>
</p>
		<form action="index.php" method="post">
			<p class="no-bottom-margin" id="codeline">
				<code>/redaxo/include/addons/seo42/install/_htaccess</code> &nbsp;<?php 
echo $I18N->msg('seo42_setup_to');
?>
&nbsp; <code>/.htaccess</code>
			</p>

			<?php 
if (seo42::getServerSubDir() != '' || seo42_utils::hasHtaccessSubDirRewriteBase()) {
    ?>
			<p class="rex-form-checkbox rex-form-label-right"> 
				<input type="checkbox" value="1" id="modify_rewritebase" name="modify_rewritebase" checked="checked" />
				<label for="modify_rewritebase"><?php 
    echo $I18N->msg('seo42_setup_rewritebase', seo42::getServerSubDir()) . ' <span>' . $I18N->msg('seo42_setup_required') . '</span>';
    ?>
</label>
			</p>
			<?php 
}
?>

			<p class="rex-form-checkbox rex-form-label-right"> 
				<input type="checkbox" value="1" id="directory_listing" name="directory_listing" />
				<label for="directory_listing"><?php