Exemplo n.º 1
0
             $ft->assign('CHECKBOX_NO', 'checked="checked"');
         }
         $ft->assign('OVERWRITE_PHOTO', !empty($image) ? true : false);
         if (!empty($image)) {
             $ft->define("form_imageedit", "form_imageedit.tpl");
             $ft->assign('IMAGE', $image);
             $ft->parse('IF_IMAGE_EXIST', ".form_imageedit");
         }
         $query = sprintf("\r\n                SELECT \r\n                    category_id, \r\n                    category_parent_id, \r\n                    category_name \r\n                FROM \r\n                    %1\$s \r\n                WHERE \r\n                    category_parent_id = '%2\$d'", TABLE_CATEGORY, 0);
         $sql = new DB_SQL();
         $db->query($query);
         while ($db->next_record()) {
             $c_id = $db->f("category_id");
             $c_name = $db->f("category_name");
             $query = sprintf("\r\n                    SELECT * FROM \r\n                        %1\$s \r\n                    WHERE \r\n                        category_id = '%2\$d' \r\n                    AND \r\n                        news_id = '%3\$d'", TABLE_ASSIGN2CAT, $c_id, $_GET['id']);
             $sql->query($query);
             $sql->next_record();
             $assigned = $sql->f("category_id");
             $ft->assign(array('C_ID' => $c_id, 'C_NAME' => $c_name, 'PAD' => '', 'CURRENT_CAT' => $c_id == $assigned ? 'checked="checked"' : ''));
             $ft->define("form_noteedit", "form_noteedit.tpl");
             $ft->define_dynamic("cat_row", "form_noteedit");
             $ft->parse('CAT_ROW', ".cat_row");
             get_editnews_assignedcat($c_id, 2);
         }
         $ft->parse('ROWS', "form_noteedit");
     }
     break;
 case "delete":
     // usuwanie wybranego wpisu
     // potwierdzenie usuniecia wpisu
     $confirm = empty($_POST['confirm']) ? '' : $_POST['confirm'];
Exemplo n.º 2
0
require_once 'inc/config.php';
require_once '../inc/common_lib.php';
require_once '../inc/admin_lib.php';
// mysql_server_version
get_mysql_server_version();
$lang = get_config('language_set');
require_once 'i18n/' . $lang . '/i18n.php';
require_once PATH_TO_CLASSES . '/cls_fast_template.php';
require_once PATH_TO_CLASSES . '/cls_permissions.php';
// inicjowanie klasy, wkazanie katalogu przechowuj±cego szablony
$ft = new FastTemplate('./templates/' . $lang . '/tpl');
// egzemplarz klasy obs³uguj±cej bazê danych Core
$db = new DB_SQL();
// pobieramy poziom uprawnieñ
$query = sprintf("\r\n    SELECT \r\n        permission_level \r\n    FROM \r\n        %1\$s \r\n    WHERE \r\n        login = '******'", TABLE_USERS, $_SESSION['login']);
$db->query($query);
$db->next_record();
$privileges = $db->f('permission_level');
// egzemplarz klasy do obs³ugi uprawnieñ
$perms = new permissions();
$permarr = $perms->getPermissions($privileges);
$ft->assign(array('PERMS_USER' => false, 'PERMS_WRITER' => false, 'PERMS_MODERATOR' => false, 'PERMS_TPLEDITOR' => false, 'PERMS_ADMIN' => false));
switch ($privileges) {
    case '1':
        $privilege_level = 1;
        $ft->assign('PERMS_USER', true);
        break;
    case '3':
        $privilege_level = 2;
        $ft->assign('PERMS_USER', true);
        $ft->assign('PERMS_WRITER', true);
Exemplo n.º 3
0
function set_config($name, $value)
{
    $db = new DB_SQL();
    $query = sprintf("\n        UPDATE\n            %1\$s\n        SET\n            config_value = '%2\$s'\n        WHERE\n            config_name = '%3\$s'", TABLE_CONFIG, $value, $name);
    $db->query($query);
    return true;
}
Exemplo n.º 4
0
function list_assigned_categories($id)
{
    global $ft, $rewrite;
    $query = sprintf("\r\n        SELECT \r\n            a.*, b.* \r\n        FROM \r\n            %1\$s a \r\n        LEFT JOIN \r\n            %2\$s b \r\n        ON \r\n            a.category_id = b.category_id \r\n        WHERE \r\n            a.news_id = '%3\$d'", TABLE_ASSIGN2CAT, TABLE_CATEGORY, $id);
    $sql = new DB_SQL();
    $sql->query($query);
    $count_cats = $sql->nf();
    $idx = 1;
    while ($sql->next_record()) {
        $cname = replace_amp($sql->f('category_name'));
        $cid = $sql->f('category_id');
        $category_link = (bool) $rewrite ? sprintf('1,%s,4,item.html', $cid) : 'index.php?p=4&id=' . $cid;
        $ft->assign(array('CATEGORY_NAME' => $cname, 'CATEGORY_LINK' => $category_link, 'COMMA' => $count_cats == $idx ? '' : ', '));
        $ft->parse('CAT_ROW', ".cat_row");
        $idx++;
    }
    // CAT_ROW musi byc czyste
    $ft->clear_parse('CAT_ROW');
}
Exemplo n.º 5
0
function get_editcategory_cat($category_id, $level)
{
    global $ft, $idx1, $count, $i18n;
    $lang = get_config('language_set');
    $query = sprintf("\n        SELECT \n            a.*, count(b.id) AS count \n        FROM \n            %1\$s a \n        LEFT JOIN \n            %2\$s b \n        ON \n            a.category_id = b.category_id \n        WHERE \n            category_parent_id = '%3\$d'\n        GROUP BY \n            category_id \n        ORDER BY \n            category_id \n        ASC", TABLE_CATEGORY, TABLE_ASSIGN2CAT, $category_id);
    $db = new DB_SQL();
    $db->query($query);
    while ($db->next_record()) {
        $category_id = $db->f("category_id");
        $category_name = $db->f("category_name");
        $cat_parent_id = $db->f("category_parent_id");
        $category_descrition = $db->f("category_description");
        $count = $db->f("count");
        $ft->assign(array('CATEGORY_ID' => $category_id, 'CATEGORY_NAME' => str_repeat('&nbsp; ', $level) . '<img src="templates/' . $lang . '/images/ar.gif" />&nbsp;' . $category_name, 'COUNT' => $count, 'REORDER_DOWN' => false, 'REORDER_UP' => false, 'CATEGORY_DESC' => empty($category_description) ? $i18n['edit_category'][4] : $category_description));
        // deklaracja zmiennej $idx1::color switcher
        $idx1 = empty($idx1) ? '' : $idx1;
        $idx1++;
        // naprzemienne kolorowanie wierszy tabeli
        $ft->assign('ID_CLASS', $idx1 % 2 ? 'mainList' : 'mainListAlter');
        $ft->parse('ROWS', ".row");
        get_editcategory_cat($category_id, $level + 2);
    }
}
Exemplo n.º 6
0
function list_assigned_categories($id)
{
    global $ft, $rewrite, $CoreRewrite;
    $query = sprintf("\n        SELECT \n            a.*, b.* \n        FROM \n            %1\$s a \n        LEFT JOIN \n            %2\$s b \n        ON \n            a.category_id = b.category_id \n        WHERE \n            a.news_id = '%3\$d'", TABLE_ASSIGN2CAT, TABLE_CATEGORY, $id);
    $sql = new DB_SQL();
    $sql->query($query);
    $count_cats = $sql->nf();
    $idx = 1;
    while ($sql->next_record()) {
        $cname = replace_amp($sql->f('category_name'));
        $cid = $sql->f('category_id');
        $ft->assign(array('CATEGORY_NAME' => $cname, 'CATEGORY_LINK' => $CoreRewrite->category_news($cid, $rewrite), 'COMMA' => $count_cats == $idx ? '' : ', '));
        $ft->parse('CAT_ROW', ".cat_row");
        $idx++;
    }
    // CAT_ROW musi byc czyste
    $ft->clear_parse('CAT_ROW');
}