Exemplo n.º 1
0
        $sect = $x['title'];
        $show = 1;
    } elseif ($show == 1) {
        $show = 0;
    }
    #Access
    switch ($x['see']) {
        case 1:
            $a = $lang['yes'];
            break;
        case 2:
            $a = $lang['no'];
            break;
        default:
            $a = $x['see'];
    }
    $cat[] = array('id' => $x['ID'], 'name' => $x['name'], 'num' => $x['num'], 'url' => url('bugs/edit/' . $x['ID'], '', 'admin'), 'access' => $a, 'section' => $show ? $sect : false);
    ++$num;
}
#Sections and languages
if ($num > 0) {
    $sect = $db->query('SELECT ID,title FROM ' . PRE . 'bugsect ORDER BY seq')->fetchAll(2);
    $lng = listBox('lang', 1, '');
} else {
    $sect = array();
    $lng = '';
}
#Info + links
$view->info($lang['bugsInfo'], array(url('bugs/edit', '', 'admin') => $lang['addCat'], url('bugs/sections', '', 'admin') => $lang['manSect'], url('bugs/config', '', 'admin') => $lang['opt']));
#Template
$view->add('adminCats', array('cat' => &$cat, 'langs' => &$lng, 'section' => &$sect));
Exemplo n.º 2
0
        $q2 = $db->prepare('INSERT INTO ' . PRE . 'answers (seq,IDP,a,color) VALUES (?,?,?,?)');
        for ($i = 0; $i < $num; $i++) {
            if ($an[$i][0]) {
                $q1->execute(array($an[$i][1], $i, $an[$i][2], $an[$i][0], $id));
            } elseif ($an[$i][1]) {
                $q2->execute(array($i, $id, $an[$i][1], $an[$i][2]));
            }
        }
        #Update cache of latest polls
        include './mod/polls/poll.php';
        RebuildPoll();
        #Apply changes
        $db->commit();
        $view->info($lang['saved'], array(url('editPoll', '', 'admin') => $lang['addPoll'], url('editPoll/' . $id, '', 'admin') => $lang['editPoll'], url('poll/' . $id) => $poll['name']));
        return 1;
    } catch (Exception $e) {
        $view->info($lang['error'] . $e);
    }
} elseif ($id) {
    if (!($poll = $db->query('SELECT * FROM ' . PRE . 'polls WHERE ID=' . $id)->fetch(2))) {
        return;
    }
    $an = $db->query('SELECT ID,a,color FROM ' . PRE . 'answers WHERE IDP=' . $id . ' ORDER BY seq')->fetchAll(3);
} else {
    $poll = array('name' => '', 'q' => '', 'type' => 1, 'ison' => 1, 'access' => LANG);
    $an = array(array(0, '', '#ed1c24'), array(0, '', '#22b14c'), array(0, '', '#3f48cc'));
}
#Prepare template
$view->script('lib/forms.js');
$view->add('editPoll', array('langs' => listBox('lang', 1, $id ? $poll['access'] : LANG), 'poll' => &$poll, 'item' => &$an));
Exemplo n.º 3
0
        $db->commit();
        UpdateCatPath($id);
        #Redirect
        if (isset($_GET['ref'])) {
            header('Location: ' . URL . url($id));
        }
        #Info + links
        $view->info($lang['saved'] . ' ID: ' . $id, array(url($id) => $lang['goCat'], url('editCat', '', 'admin') => $lang['addCat'], url('editCat/' . $id, '', 'admin') => $lang['editCat'], url('list/' . $id) => $lang['mantxt'], url('edit/' . $cat['type'], 'catid=' . $id) => $lang['addItem']));
        return 1;
    } catch (Exception $e) {
        $view->info($e->getMessage());
        //Errors
    }
} elseif ($id) {
    if (!($cat = $db->query('SELECT * FROM ' . PRE . 'cats WHERE ID=' . $id)->fetch(2))) {
        //ASSOC
        return;
    }
} else {
    $cat = array('name' => '', 'dsc' => '', 'type' => isset($_GET['type']) ? (int) $_GET['type'] : 5, 'sc' => 0, 'text' => '', 'sort' => 2, 'opt' => 15, 'access' => 1);
}
#Editor JS
if (isset($cfg['wysiwyg']) && is_dir('plugins/editor')) {
    $view->script('plugins/editor/loader.js');
} else {
    $view->script(LANG_DIR . 'edit.js');
    $view->script('lib/editor.js');
}
#Prepare template
$view->add('editCat', array('cat' => &$cat, 'o1' => $cat['opt'] & 1, 'o2' => $cat['opt'] & 2, 'o3' => $cat['opt'] & 4, 'o4' => $cat['opt'] & 8, 'o5' => $cat['opt'] & 16, 'cats' => Slaves(0, $cat['sc'], $id), 'langs' => listBox('lang', 1, $cat['access'])));
Exemplo n.º 4
0
            }
        }
        $db->commit();
        #Update menu cache
        include './lib/mcache.php';
        RenderMenu();
        #Redirect
        header('Location: ' . URL . url('menu', '', 'admin'));
        $view->message($lang['saved'], url('menu', '', 'admin'));
    } catch (PDOException $e) {
        $view->info($e->getMessage());
    }
} elseif ($id) {
    if (!($m = $db->query('SELECT * FROM ' . PRE . 'menu WHERE ID=' . $id)->fetch(2))) {
        return;
    }
    if ($m['type'] == 3) {
        $o = $db->query('SELECT text,type,url,nw FROM ' . PRE . 'mitems WHERE menu=' . $id . ' ORDER BY seq')->fetchAll(3);
    } else {
        $o = array();
    }
} else {
    $m = array('text' => '', 'disp' => '', 'img' => '0', 'menu' => 1, 'type' => 3, 'value' => '');
    $o = array(array('', 4, '', 0));
}
#Categories and free pages
$cats = $db->query('SELECT ID,name FROM ' . PRE . 'cats WHERE access!=3 ORDER BY name')->fetchAll(12);
$free = $db->query('SELECT ID,name FROM ' . PRE . 'pages WHERE access!=0 ORDER BY name')->fetchAll(12);
$view->script('lib/forms.js');
$view->add('editMenu', array('menu' => &$m, 'item' => &$o, 'cats' => json_encode($cats), 'pages' => json_encode($free), 'fileman' => admit('FM'), 'langlist' => listBox('lang', 1, $m['disp'])));
Exemplo n.º 5
0
        include './admin/config.php';
        return 1;
    } catch (Exception $e) {
        $view->info($e);
    }
} else {
    $opt =& $cfg;
}
include LANG_DIR . 'admCfg.php';
#Style
$skin = '';
foreach (scandir('style') as $x) {
    if ($x[0] != '.' && is_dir('style/' . $x) && file_exists('style/' . $x . '/body.html')) {
        $skin .= '<option' . ($cfg['skin'] == $x ? ' selected="selected"' : '') . '>' . $x . '</option>';
    }
}
#API keys
if (empty($cfg['pubKey'])) {
    $cfg['pubKey'] = '';
}
if (empty($cfg['prvKey'])) {
    $cfg['prvKey'] = '';
}
if (empty($cfg['sbKey'])) {
    $cfg['sbKey'] = '';
}
#Page title
$view->title = $lang['main'];
#Template
$view->add('configMain', array('cfg' => &$opt, 'skinlist' => &$skin, 'langlist' => listBox('lang', 1, $opt['lang'])));
Exemplo n.º 6
0
    #Change record or add new
    try {
        if ($id) {
            $cat['id'] = $id;
            $q = $db->prepare('UPDATE ' . PRE . 'bugcats SET sect=:sect, name=:name, dsc=:dsc, see=:see, post=:post, rate=:rate, text=:text WHERE ID=:id');
        } else {
            $q = $db->prepare('INSERT INTO ' . PRE . 'bugcats (sect,name,dsc,see,post,rate,text) VALUES (:sect,:name,:dsc,:see,:post,:rate,:text)');
        }
        $q->execute($cat);
        #Redirect to category list
        header('Location: ' . URL . url('bugs', '', 'admin'));
        $view->message($lang['saved'], url('bugs', '', 'admin'));
    } catch (PDOException $e) {
        $view->info($e);
    }
} elseif ($id) {
    if (!($cat = $db->query('SELECT * FROM ' . PRE . 'bugcats WHERE ID=' . $id)->fetch(2))) {
        return;
    }
} else {
    $cat = array('sect' => 1, 'name' => '', 'dsc' => '', 'see' => LANG, 'post' => 'ALL', 'rate' => 1, 'text' => '');
}
#Sections
$sect = array();
$res = $db->query('SELECT ID,title FROM ' . PRE . 'bugsect ORDER BY seq');
foreach ($res as $x) {
    $sect[] = array('id' => $x['ID'], 'title' => $x['title'], 'this' => $x['ID'] == $cat['sect']);
}
#Form template
$view->add('adminEdit', array('cat' => &$cat, 'sect' => &$sect, 'langs' => listBox('lang', 1, $cat['see']), 'title' => $id ? $lang['editCat'] : $lang['addCat']));
Exemplo n.º 7
0
        $q->execute($group);
        if (!$id) {
            $id = $db->lastInsertId();
        }
        #Redirect
        if (isset($_GET['ref'])) {
            header('Location: ' . URL . url('group/' . $id));
        }
        $view->info($lang['saved'], array(url('group/' . $id) => $group['name'], url('editGroup/' . $id, '', 'admin') => $lang['editGroup'], url('editGroup', '', 'admin') => $lang['addGroup']));
        return 1;
    } catch (PDOException $e) {
        $view->info($lang['error'] . $e->getMessage());
    }
} elseif ($id) {
    if (!($group = $db->query('SELECT * FROM ' . PRE . 'groups WHERE ID=' . $id)->fetch(2))) {
        return;
    }
} else {
    $group = array('name' => '', 'access' => 1, 'opened' => 1, 'dsc' => '');
}
#Editor JS
if (isset($cfg['wysiwyg']) && is_dir('plugins/editor')) {
    $view->script('plugins/editor/loader.js');
} else {
    $view->script(LANG_DIR . 'edit.js');
    $view->script('cache/emots.js');
    $view->script('lib/editor.js');
}
#Template
$view->add('editGroup', array('group' => &$group, 'langs' => listBox('lang', 1, $id ? $group['access'] : null)));
Exemplo n.º 8
0
if ($_POST) {
    $rss = array('name' => clean($_POST['name']), 'dsc' => clean($_POST['dsc']), 'url' => clean($_POST['url']), 'lang' => ctype_alnum($_POST['lang']) ? $_POST['lang'] : LANG, 'auto' => isset($_POST['auto']), 'cat' => (int) $_POST['cat'], 'num' => (int) $_POST['num']);
    try {
        if ($id) {
            $q = $db->prepare('UPDATE ' . PRE . 'rss SET auto=:auto, name=:name, dsc=:dsc,
			url=:url, lang=:lang, cat=:cat, num=:num WHERE ID=' . $id);
        } else {
            $q = $db->prepare('INSERT INTO ' . PRE . 'rss (auto,name,dsc,url,lang,cat,num)
			VALUES (:auto,:name,:dsc,:url,:lang,:cat,:num)');
        }
        $q->execute($rss);
        if (!$id) {
            $id = $db->lastInsertId();
        }
        #Rebuild RSS
        RSS($id);
        header('Location: ' . URL . url('rss/update', '', 'admin'));
        return 1;
    } catch (Exception $e) {
        $view->info($e);
    }
} elseif ($id) {
    if (!($rss = $db->query('SELECT * FROM ' . PRE . 'rss WHERE ID=' . $id)->fetch(2))) {
        return;
    }
} else {
    $rss = array('name' => '', 'dsc' => '', 'auto' => 1, 'num' => 20, 'cat' => 0, 'lang' => LANG, 'url' => URL);
}
#Prepare template
$view->add('editRss', array('rss' => $rss, 'cats' => Slaves(5, $rss['cat']), 'langs' => listBox('lang', 1, $rss['lang'])));
Exemplo n.º 9
0
            $db->exec('DELETE FROM ' . PRE . 'mitems WHERE menu NOT IN (SELECT ID FROM ' . PRE . 'menu)');
        }
        $db->commit();
        $view->info($lang['saved']);
        unset($q, $seq, $_POST);
        #Rebuild menu cache
        require './lib/mcache.php';
        RenderMenu();
    } catch (PDOException $e) {
        $view->info($lang['error'] . $e);
        return 1;
    }
}
#Get menu blocks
$res = $db->query('SELECT ID,seq,text,disp,menu,type FROM ' . PRE . 'menu ORDER BY disp,menu,seq');
$res->setFetchMode(3);
//Num
$num = 0;
$lng = '1';
$prev = '1';
$blocks = array();
foreach ($res as $m) {
    if ($m[3] != $prev && $m[3] != '3' && $m[3] != '2') {
        $lng = $prev = $m[3];
    } else {
        $lng = false;
    }
    $blocks[] = array('id' => $m[0], 'seq' => $m[1], 'url' => url('editMenu/' . $m[0], '', 'admin'), 'langs' => listBox('lang', 1, $m[3]), 'disp' => $m[3], 'title' => $m[2], 'page' => $m[4], 'group' => $lng);
}
#Do szablonu
$view->add('menu', array('blocks' => $blocks, 'newURL' => url('editMenu', '', 'admin')));