Beispiel #1
0
     $informers = get_informers();
     //получаем список всех информеров
     $get_link = get_link($link_id);
     if ($_POST) {
         if (edit_link($link_id)) {
             redirect('?view=informers');
         } else {
             redirect();
         }
         //иначе на эту же страницу возвращаемся
     }
     break;
 case 'del_link':
     //удаление страницы информера
     $link_id = (int) $_GET['link_id'];
     del_link($link_id);
     redirect();
     break;
 case 'edit_page':
     //редактирование страницы
     $page_id = (int) $_GET['page_id'];
     $get_page = get_page($page_id);
     if ($_POST) {
         //проверяем были ли переданы данные из формы
         if (edit_page($page_id)) {
             redirect('?view=pages');
         } else {
             redirect();
         }
         //иначе редирект на эту же стр, откуда пришли
     }
                }
            }
        }
        display_link_form($vars, $err);
        break;
    case 'edit_link':
        if ($vars['save']) {
            $err = validate_link_form($vars);
            if (!$err) {
                $err = edit_link($vars, $vars['banner_id']);
                if (!$err) {
                    display_banners();
                    break;
                } else {
                    $b = $vars;
                }
            } else {
                $b = $vars;
            }
        } else {
            $b = $config['aff']['links'][$vars['banner_id']];
        }
        display_link_form($b, $err);
        break;
    case 'del_link':
        del_link($vars['banner_id']);
        display_banners();
        break;
    default:
        display_banners();
}
<br /><br /><br />
<div id="popup1" class="msg"><h3>Eintrag wurde aktualisiert!</h3></div>
<?
######## DELETE Link ##############
if($subpage=="del") {
include("core/del_new_link.htm");
if($delquest=="YES") { del_link($pageid); echo"<meta http-equiv='refresh' content='0; URL=index.php?s=links'>"; }
}


############ Eintrag aktualisieren ##############
if($_POST['send']=="update"){

$p_rating=$_POST['rating'];
$p_category=$_POST['category'];
$p_url=$_POST['url'];
$p_Titel=$_POST['Titel'];
$p_beschreibung=$_POST['beschreibung'];
$p_typ=$_POST['typ'];
$p_keywords=$_POST['keywords'];
$p_firma=$_POST['firma'];
$p_name=$_POST['name'];
$p_strasse=$_POST['strasse'];
$p_ort=$_POST['ort'];
$p_email=$_POST['email'];

dbconnect();
$sql_layout_update = "UPDATE `".get_db_table("link")."` SET `id_kategorie`='".$p_category."', `url`='".$p_url."', `titel`='".$p_Titel."', `beschreibung`='".$p_beschreibung."', `typ`='".$p_typ."', `email`='".$p_email."', `ratinglink`='".$p_rating."', `keywords`='".$p_keywords."', `firma`='".$p_firma."', `name`='".$p_name."', `strasse`='".$p_strasse."', `ort`='".$p_ort."' ";
$sql_layout_update .= " WHERE `id_link`='".$pageid."'";
mysql_query($sql_layout_update);
Beispiel #4
0
    $total_sql = "SELECT COUNT(*) AS num FROM " . table('link') . " AS l " . $joinsql . $wheresql;
    $page = new page(array('total' => $db->get_total($total_sql), 'perpage' => $perpage));
    $currenpage = $page->nowindex;
    $offset = ($currenpage - 1) * $perpage;
    $link = get_links($offset, $perpage, $joinsql . $wheresql . $oederbysql);
    $smarty->assign('link', $link);
    $smarty->assign('page', $page->show(3));
    $smarty->assign('upfiles_dir', $upfiles_dir);
    $smarty->assign('get_link_category', get_link_category());
    $smarty->assign('navlabel', "list");
    $smarty->display('link/admin_link.htm');
} elseif ($act == 'del_link') {
    check_token();
    check_permissions($_SESSION['admin_purview'], "link_del");
    $id = $_REQUEST['id'];
    if ($num = del_link($id)) {
        adminmsg("删除成功!共删除" . $num . "行", 2);
    } else {
        adminmsg("删除失败!", 0);
    }
} elseif ($act == 'add') {
    get_token();
    check_permissions($_SESSION['admin_purview'], "link_add");
    $id = !empty($_GET['id']) ? trim($_GET['id']) : '';
    $smarty->assign('cat', get_link_category());
    $smarty->assign('navlabel', "add");
    $smarty->display('link/admin_link_add.htm');
} elseif ($act == 'addsave') {
    check_token();
    check_permissions($_SESSION['admin_purview'], "link_add");
    $setsqlarr['link_name'] = $_POST['link_name'] ? trim($_POST['link_name']) : adminmsg('链接名称不能为空!', 1);
Beispiel #5
0
         foreach ($_POST['form_gram'] as &$grams) {
             $grams = implode(', ', $grams);
         }
     }
     if (!empty($_POST['lemma_gram'])) {
         $_POST['lemma_gram'] = implode(', ', $_POST['lemma_gram']);
     }
     $lemma_id = dict_save($_POST);
     header("Location:dict.php?act=edit&saved&id={$lemma_id}");
     break;
 case 'add_link':
     add_link($_POST['from_id'], $_POST['lemma_id'], $_POST['link_type']);
     header("Location:dict.php?act=edit&id=" . $_POST['from_id']);
     break;
 case 'del_link':
     del_link($_GET['id']);
     header("Location:dict.php?act=edit&id=" . $_GET['lemma_id']);
     break;
 case 'change_link_dir':
     change_link_direction($_GET['id']);
     header("Location:dict.php?act=edit&id=" . $_GET['lemma_id']);
     break;
 case 'del_lemma':
     del_lemma($_GET['lemma_id']);
     header("Location:dict.php");
     break;
 case 'lemmata':
     $smarty->assign('search', get_dict_search_results($_GET));
     $smarty->display('dict/lemmata.tpl');
     break;
 case 'gram':
Beispiel #6
0
    function sp_get_macros()
    {
        global $page, $mod_comments, $_CATEGORIES, $ver, $categories, $my_lang_profile, $ENGINE_URL, $SITE_URL;
        $tmpl_list = array();
        // staff
        $tmpl_list['index']['site_name'] = SITE_NAME;
        $tmpl_list['index']['main'] = my_lang('main');
        $tmpl_list['index']['url'] = SITE_URL;
        $tmpl_list['index']['crumbs'] = get_crumbs();
        $tmpl_list['index']['header'] = get_head();
        //Заголовки [модуль headers]
        $tmpl_list['index']['path'] = ENGINE_URL . '/themes/' . THEME;
        $tmpl_list['index']['site_description'] = SITE_DESC;
        //подзаголовок
        $tmpl_list['index']['Y'] = date("Y");
        $tmpl_list['index']['te_version'] = $ver;
        $tmpl_list['index']['rss'] = SITE_RSS;
        $tmpl_list['index']['auth_menu'] = bc_auth_menu();
        //<li> меню авторизации
        if (isset($_SESSION['name'])) {
            $tmpl_list['index']['user'] = $_SESSION['name'];
            /* $tmpl_list['index']['profile_link'] = <<<_MPF
                                                <a href="$SITE_URL/lib/window/profile.php" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=500,top=10'); return false;">$my_lang_profile</a>
            _MPF; */
        }
        //рубрики <li>
        foreach ($categories as $cat) {
            if ($cat['cat_count'] !== "0") {
                $tmpl_list['index']['cat_list'] .= '
                <li><a href="' . get_link('category', $cat['category_id']) . '">' . $cat['name'] . ' 
                <small>(' . $cat['cat_count'] . ')</small></a></li>
                ';
            }
        }
        //список страниц <li>
        $menu = get_static_list_rank();
        foreach ($menu as $link) {
            $tmpl_list['index']['menu'] .= '<li><a href="' . SITE_URL . '/' . $link['sef'] . '">' . $link['title'] . '</a></li>';
        }
        ## Cтраница
        if ($page == 'static' || isset($_REQUEST['s'])) {
            $tmpl_list['static']['title'] = print_static("title");
            $tmpl_list['static']['static'] = print_static("content");
            $f = TE_DIR . '/themes/' . THEME . '/static.html';
            if (is_file($f)) {
                $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['static']);
            }
        } elseif (($page == 'article' || $page == 'main') && !isset($_REQUEST['id'])) {
            //список записей
            $DB = get_article_list();
            if (!empty($DB)) {
                if (isset($_REQUEST['category_id'])) {
                    $tmpl_list['index']['title'] = $_CATEGORIES[$_REQUEST['category_id']]['name'];
                }
                foreach ($DB as $p) {
                    if ($p['approve'] == 1) {
                        //формируем ссылку
                        if (!USE_SEF) {
                            $link = SITE_URL . '/?id=' . $p['id'];
                        } elseif (SEF_TYPE == 1) {
                            $link = SITE_URL . '/article/' . $_CATEGORIES[$p['category_id']]['sef'] . '/' . $p['sef'];
                        } elseif (SEF_TYPE == 2) {
                            $link = SITE_URL . '/' . $_CATEGORIES[$p['category_id']]['sef'] . '/' . $p['sef'];
                        }
                    }
                    if (@$_SESSION['status'] == 'admin') {
                        $tmpl_list['post_list']['post_edit_link'] = <<<_le
                    <a href="{$SITE_URL}/window/ca/?id={$p['id']}&action=edit" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=850,left=150,height=640,top=10'); return false;">Редактор</a>
_le;
                        $tmpl_list['post_list']['post_edit_url'] = "{$SITE_URL}/window/ca/?id={$p['id']}&action=edit";
                    }
                    $tmpl_list['post_list']['title'] = $p['title'];
                    if ($p['description'] !== '') {
                        $tmpl_list['post_list']['post'] = $p['description'] . ' <a href="' . $link . '">' . my_lang("article_more") . '</a>';
                    } else {
                        $tmpl_list['post_list']['post'] = $p['content'];
                    }
                    $tmpl_list['post_list']['post_url'] = $link;
                    $tmpl_list['post_list']['post_date'] = date(DATE_FORMAT, gm2local($p['stamp'], TZ));
                    $tmpl_list['post_list']['post_category_url'] = get_link('category', $p['category_id']);
                    $tmpl_list['post_list']['post_category'] = $_CATEGORIES[$p['category_id']]['name'];
                    $tmpl_list['post_list']['post_author'] = $p['author'];
                    $f = TE_DIR . '/themes/' . THEME . '/post_list.html';
                    if (is_file($f)) {
                        $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['post_list']);
                    }
                }
                $tmpl_list['index']['navi'] = get_navi(get_artcl_sum(), ARTCLS_PER_PAGE);
            }
        } elseif (isset($_REQUEST['id'])) {
            //$tmpl_post = array_merge($tmpl_list, $tmpl_post);
            $profile = get_profile(print_article('author_id'));
            ## тело записи
            $tmpl_list['post']['title'] = print_article("title");
            $tmpl_list['post']['post'] = print_article("content");
            $tmpl_list['post']['post_category_url'] = get_link('category');
            $tmpl_list['post']['post_author'] = $profile['name'];
            $a_id = print_article("author_id");
            $tmpl_list['post']['post_author_link'] = <<<_APF
                                    <a href="{$SITE_URL}/window/profile/?author_id={$a_id}" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=250,top=10'); return false;">{$profile["name"]}</a>
_APF;
            if (@$_SESSION['status'] == 'admin') {
                $tmpl_list['post']['post_edit_link'] = <<<_APE
                                    <a href="{$SITE_URL}/window/ca/?id={$_REQUEST['id']}&action=edit" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=850,left=150,height=640,top=10'); return false;">Редактор</a>
_APE;
                $tmpl_list['post']['post_edit_url'] = "{$SITE_URL}/window/ca/?id={$_REQUEST['id']}&action=edit";
            }
            $tmpl_list['post']['post_date'] = date(DATE_FORMAT, gm2local(print_article('stamp'), TZ));
            $tmpl_list['post']['post_category'] = $_CATEGORIES[$_REQUEST['category_id']]['name'];
            $f = TE_DIR . '/themes/' . THEME . '/post.html';
            $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['post']);
            ## комментарии
            if ($mod_comments) {
                //если модуль "вкл"
                function del_link($id)
                {
                    if ($_SESSION['status'] == 'admin') {
                        return '  <a href="' . SITE_URL . '/?id=' . $_REQUEST['id'] . '&cid=' . $id . '&com_act=del">X</a>';
                    } else {
                        return '';
                    }
                }
                $comm_data = get_comments();
                //получаем список комментов и начинаем обходить шаблон комментария
                if (isset($comm_data[0])) {
                    foreach ($comm_data as $p) {
                        $profile = get_profile($p['author_id']);
                        //комментатор не зарег-н
                        if (empty($p['author_id'])) {
                            $tmpl_list['comment']['name'] = $p['author'];
                            //if (!empty($p['email'])) {
                            $gra = get_gravatar($p['email'], $size = 35);
                            //}
                        } else {
                            $gra = get_gravatar($profile['email'], $size = 35);
                            $tmpl_list['comment']['name'] = <<<_PF
                        <a href="{$SITE_URL}/window/profile?author_id={$p["author_id"]}" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=250,top=10'); return false;">{$profile['name']}</a>
_PF;
                        }
                        $tmpl_list['comment']['name'] .= del_link($p['id']);
                        $tmpl_list['comment']['gravatar'] = $gra['img'];
                        $tmpl_list['comment']['gravatar_url'] = $gra['url'];
                        $tmpl_list['comment']['date'] = date(DATE_FORMAT, gm2local($p['date'], TZ));
                        //[lib.php, date = stamp]
                        $tmpl_list['comment']['comment'] = $p['content'];
                        $f = TE_DIR . '/themes/' . THEME . '/comment.html';
                        $tmpl_list['comment_list']['comments'] .= sp_get_skin($f, $tmpl_list['comment']);
                    }
                }
                $tmpl_list['comment_list']['comments_form'] = print_comments_form();
                //и вставляем полученный список комментариев в шаблон списка комментариев (вот неожиданность:)
                if (is_file(TE_DIR . '/themes/' . THEME . '/comment_list.html')) {
                    $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/comment_list.html', $tmpl_list['comment_list']);
                }
            }
        } elseif ($page == "album") {
            if (is_file(TE_DIR . '/themes/' . THEME . '/album.html')) {
                $album = get_album();
                if (!empty($album)) {
                    foreach ($album as $img) {
                        $tmpl_list['album']['album'] .= '<a target="_blank" href="' . $img['url'] . '"> 
                <img src="' . $img['url'] . '" HSPACE="0" VSPACE="0" border="0"
                title="Добавлена ' . date("d.m.Y H:i:s", $img['time']) . '" style="max-height: 70px;">
                </a>';
                    }
                } else {
                    $tmpl_list['album']['album'] .= my_lang('album_empty');
                }
                $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/album.html', $tmpl_list['album']);
            } else {
                $tmpl_list['index']['content'] .= 'Не обнаружено файла-шаблона для альбома(';
            }
        } elseif ($page == "feedback") {
            if (is_file(TE_DIR . '/themes/' . THEME . '/feedback.html')) {
                $tmpl_list['feedback']['sid'] = get_sid();
                $reg = Registry::instance();
                $tmpl_list['feedback']['feedback_msg'] = $reg->get('feedback_msg');
                $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/feedback.html', $tmpl_list['feedback']);
            }
        }
        //список последних записей <li><a>link</a></li>
        $tmpl_list['index']['post_list'] = bc_postlist(7);
        $tmpl_list['index']['theme_list'] = bc_theme_list();
        $tmpl_list['index']['time'] = microtime(true) - ST;
        return $tmpl_list;
    }
Beispiel #7
0
function change_link_direction($link_id)
{
    check_permission(PERM_DICT);
    if (!$link_id) {
        throw new UnexpectedValueException();
    }
    sql_begin();
    $revset_id = create_revset();
    $res = sql_pe("SELECT * FROM dict_links WHERE link_id=? LIMIT 1", array($link_id));
    del_link($link_id, $revset_id);
    add_link($res[0]['lemma2_id'], $res[0]['lemma1_id'], $res[0]['link_type'], $revset_id);
    sql_commit();
}