Beispiel #1
0
/**
 * Gets child objects of current object
 * @param string $object_type object type
 * @return array children
 */
function fn_seo_get_object_children($object_type)
{
    $children = array();
    $schema = fn_get_seo_vars();
    foreach ($schema as $type => $params) {
        if (!empty($params['parent_type']) && $params['parent_type'] == $object_type) {
            $children[] = $type;
        }
    }
    return $children;
}
        }
    }
    if ($mode == 'm_delete') {
        if (!empty($_REQUEST['redirect_ids'])) {
            foreach ($_REQUEST['redirect_ids'] as $redirect_id) {
                fn_delete_seo_redirect($redirect_id);
            }
        }
    }
    return array(CONTROLLER_STATUS_OK, "seo_redirects.manage");
}
if ($mode == 'manage') {
    list($seo_redirects, $search) = fn_get_seo_redirects($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'));
    Registry::get('view')->assign('seo_redirects', $seo_redirects);
    Registry::get('view')->assign('search', $search);
    Registry::get('view')->assign('seo_vars', fn_get_seo_vars());
} elseif ($mode == 'delete') {
    if (!empty($_REQUEST['redirect_id'])) {
        fn_delete_seo_redirect($_REQUEST['redirect_id']);
    }
    return array(CONTROLLER_STATUS_OK, "seo_redirects.manage");
}
function fn_get_seo_redirects($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
    // Init filter
    $params = LastView::instance()->update('seo_redirects', $params);
    // Set default values to input params
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    $condition = '';
    if (isset($params['src']) && fn_string_not_empty($params['src'])) {
Beispiel #3
0
                fn_delete_seo_redirect($redirect_id);
            }
        }
    }
    if ($mode == 'delete') {
        if (!empty($_REQUEST['redirect_id'])) {
            fn_delete_seo_redirect($_REQUEST['redirect_id']);
        }
    }
    return array(CONTROLLER_STATUS_OK, 'seo_redirects.manage');
}
if ($mode == 'manage') {
    list($seo_redirects, $search) = fn_get_seo_redirects($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'));
    Tygh::$app['view']->assign('seo_redirects', $seo_redirects);
    Tygh::$app['view']->assign('search', $search);
    Tygh::$app['view']->assign('seo_vars', fn_get_seo_vars());
}
function fn_get_seo_redirects($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
    // Init filter
    $params = LastView::instance()->update('seo_redirects', $params);
    // Set default values to input params
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    $condition = '';
    if (isset($params['src']) && fn_string_not_empty($params['src'])) {
        $condition .= db_quote(" AND src LIKE ?l", "%" . trim($params['src']) . "%");
    }
    if (!empty($params['type'])) {
        $condition .= db_quote(" AND type = ?s", $params['type']);
    }
Beispiel #4
0
/**
 * Checks whether object related to SEO-name exists at database, using functions specified at SEO objects schema.
 *
 * @param int    $object_id   Object ID
 * @param string $object_type Object type (array key at SEO objects schema)
 *
 * @return bool|null Whether given object exists or null if no checking function is specified at schema.
 */
function fn_check_seo_object_exists($object_id, $object_type, $company_id)
{
    $schema = fn_get_seo_vars();
    if (!empty($schema[$object_type])) {
        if (isset($schema[$object_type]['exist_function'])) {
            return $schema[$object_type]['exist_function']($object_id, $company_id);
        }
    }
    return null;
}
Beispiel #5
0
    if (!empty($params['items_per_page'])) {
        $params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:hw_404 ?p WHERE ?p ?p ?p", $join, $condition, $group_by, $sorting);
        $limit = db_paginate($params['page'], $params['items_per_page']);
    }
    $errors = db_get_hash_array("SELECT " . implode(', ', $fields) . " FROM ?:hw_404 ?p WHERE ?p ?p ?p ?p", 'id', $join, $condition, $group_by, $sorting, $limit);
    //generate urls
    if (!empty($_REQUEST['show']) && $_REQUEST['show'] == 'all' && !empty($errors)) {
        foreach ($errors as $key => $error) {
            if ($error['object_id'] > 0) {
                $errors[$key]['redirect'] = fn_hw_404_fixer_generate_url($error['type'], $error['object_id']);
            }
        }
    }
    Registry::get('view')->assign('errors', $errors);
    Registry::get('view')->assign('search', $params);
    #stats
    $hw_404_stats = array();
    $hw_404_stats['total'] = (int) db_get_field('SELECT COUNT(*) FROM ?:hw_404');
    $hw_404_stats['redirected'] = (int) db_get_field('SELECT COUNT(*) FROM ?:hw_404 WHERE (`redirect` IS NOT NULL AND `redirect`!=?s) OR (object_id>0)', '');
    $hw_404_stats['pending'] = $hw_404_stats['total'] - $hw_404_stats['redirected'];
    Registry::get('view')->assign('hw_404_stats', $hw_404_stats);
}
if ($mode == 'update') {
    $error_data = db_get_row('SELECT * FROM ?:hw_404 WHERE id=?i', $_REQUEST['id']);
    Registry::get('view')->assign('error_data', $error_data);
    $seo_vars = array();
    if (Registry::get('addons.seo')) {
        $seo_vars = fn_get_seo_vars();
    }
    Registry::get('view')->assign('seo_vars', $seo_vars);
}