コード例 #1
0
ファイル: pages.class.php プロジェクト: jankuca/geecms
 public function fetch()
 {
     if (!$this->made) {
         return array();
     }
     $start = $this->current_page * $this->per_page - $this->per_page;
     $query = $this->query . " LIMIT " . $start . "," . $this->per_page;
     $sql = new MySQLObject();
     if (!$sql->query($query)) {
         return array();
     }
     return $sql->fetch();
 }
コード例 #2
0
ファイル: menu.mod.php プロジェクト: jankuca/geecms
 public function mainmenu_items()
 {
     global $tpl, $cfg;
     $sql = new MySQLObject();
     if ($sql->query("\r\nSELECT `iid`,`header`,`link`,`show`\r\nFROM " . $sql->table('menu') . "\r\nORDER BY `order` ASC")) {
         $num = $sql->num();
         if ($num == 0) {
             $tpl->assign('INFOBAR', true, 'if');
             $tpl->assign('INFOBAR', '{L_MENU_MAINMENU_NO_ITEMS}');
         }
         $f_items = array();
         $i = 0;
         foreach ($sql->fetch() as $item) {
             $f_items[] = array('ITEM_HEADER' => $item->header, 'ITEM_LINK' => './' . $item->link, 'ITEM_ID' => $item->iid, 'ITEM_LINK_EDIT' => './acp.php?c=menu&amp;mode=edit&amp;iid=' . $item->iid, 'ITEM_LINK_DELETE' => './action.php?c=menu&amp;mode=delete&amp;iid=' . $item->iid, 'ITEM_LINK_SHOW_HIDE' => './action.php?c=menu&amp;mode=' . ($item->show == 0 ? 'show' : 'hide') . '&amp;iid=' . $item->iid, 'ITEM_TEXT_SHOW_HIDE' => $item->show == 0 ? '{L_SHOW}' : '{L_HIDE}', 'ITEM_LINK_MOVEUP' => $i == 0 ? '' : str_replace('<var(LINK)>', './action.php?c=menu&amp;mode=move&amp;dir=up&amp;iid=' . $item->iid, $cfg['tpl']['link']['moveup']), 'ITEM_LINK_MOVEDOWN' => $i == $num - 1 ? '' : str_replace('<var(LINK)>', './action.php?c=menu&amp;mode=move&amp;dir=down&amp;iid=' . $item->iid, $cfg['tpl']['link']['movedown']));
             $i++;
         }
         if (count($f_items) > 0) {
             $tpl->assign('MENU_MAINMENU', true, 'if');
             $tpl->assign('MENU_MAINMENU', $f_items, 'foreach');
         } else {
             $tpl->assign('MENU_MAINMENU', false, 'if');
         }
     }
 }
コード例 #3
0
ファイル: pages.mod.php プロジェクト: jankuca/geecms
 public function menu_add_items()
 {
     $items = array();
     $sql = new MySQLObject();
     if ($sql->query("SELECT `pid`,`header` FROM " . $sql->table('pages') . " ORDER BY `slug` ASC")) {
         global $cfg;
         foreach ($sql->fetch() as $page) {
             $items[] = array('ADD_TEXT' => $page->header, 'ADD_LINK' => './action.php?c=menu&amp;mode=add&amp;module=pages&amp;pid=' . $page->pid);
         }
     }
     return $items;
 }
コード例 #4
0
                        $query .= "\r\n)\r\nORDER BY `date` ASC";
                        if (!$sql->query($query)) {
                            echo 'ERROR';
                        } else {
                            if (!$sql->num()) {
                                echo 'NO_UPDATES';
                            } else {
                                $installed = array();
                                foreach ($xml->installed->children() as $update) {
                                    $update = $update->getAttributesArray(array('code'));
                                    $installed[] = $update['code'];
                                }
                                $xml = '<?xml version="1.0" encoding="utf-8"?>
<root>' . '<updates>';
                                $updates = 0;
                                foreach ($sql->fetch() as $update) {
                                    if (!in_array($update->code, $installed)) {
                                        $xml .= '<update type="' . $update->type . '">' . '<code>' . $update->code . '</code>' . '<name>' . $update->name . '</name>' . '<modules>' . $update->modules . '</modules>' . '</update>';
                                        $updates++;
                                    }
                                }
                                $xml .= '</updates>' . '</root>';
                                if ($updates > 0) {
                                    echo $xml;
                                } else {
                                    echo 'NO_UPDATES';
                                }
                            }
                        }
                    }
                }
コード例 #5
0
ファイル: template.php プロジェクト: jankuca/geecms
 public function _module_config($query)
 {
     global $tpl, $cfg;
     $sql = new MySQLObject();
     if ($sql->query($query)) {
         foreach ($sql->fetch() as $item) {
             switch ($item->type) {
                 case 'string':
                     $tpl->assign('CONFIG.' . strtoupper($item->name), $item->value);
                     break;
                 case 'bool':
                     $tpl->assign(array('CONFIG.' . strtoupper($item->name) . '.TRUE.CHECKED' => intval($item->value) == 1 ? $cfg['tpl']['checked'] : '', 'CONFIG.' . strtoupper($item->name) . '.FALSE.CHECKED' => intval($item->value) == 0 ? $cfg['tpl']['checked'] : ''));
                     break;
             }
         }
     }
 }
コード例 #6
0
ファイル: users.mod.php プロジェクト: jankuca/geecms
 public function group_edit()
 {
     global $cfg, $q;
     // the total count of all permissions
     $count = 0;
     // get the changed permissions
     foreach ($cfg['permissions'] as $module => $names) {
         foreach ($names as $name => $values) {
             if (isset($_POST['group_permissions'][$module][$name])) {
                 $out[$module][$name] = implode(';', $_POST['group_permissions'][$module][$name]);
             } else {
                 $out[$module][$name] = '';
             }
             $count++;
         }
     }
     // get the old permissions
     $sql = new MySQLObject();
     $sql->query("SELECT `name`,`module` FROM " . $q->table('permissions') . " WHERE (`group` = " . intval($_GET['gid']) . ")");
     $to_update = array();
     $to_update_count = 0;
     foreach ($sql->fetch() as $perm) {
         $to_update[$perm->module][$perm->name] = true;
         $to_update_count++;
     }
     // update/insert the changed permissions
     $query = "INSERT INTO " . $q->table('permissions') . " (`name`,`group`,`module`,`value`) VALUES";
     $i = 0;
     foreach ($out as $module => $names) {
         foreach ($names as $name => $value) {
             if (isset($to_update[$module][$name])) {
                 $sql->query("UPDATE " . $q->table('permissions') . " SET `value` = '" . $sql->escape($value) . "' WHERE (`module` = '" . $module . "' AND `name` = '" . $name . "' AND `group` = " . intval($_GET['gid']) . ")");
             } else {
                 $query .= " ('" . $name . "'," . intval($_GET['gid']) . ",'" . $module . "','" . $sql->escape($value) . "')";
                 if ($i != $count - $to_update_count) {
                     $query .= ",";
                 }
                 # !! echo($i . $count . $to_update_count);
                 $i++;
             }
         }
     }
     if ($i != 0) {
         $sql->query($query);
     }
     global $syslog, $tpl, $action;
     if (!$action) {
         $action = true;
         $tpl->assign('REDIRECT_LOCATION', './acp.php?c=users');
         $tpl->load('alert_success');
         $tpl->inc('alert_success');
         $tpl->assign('ALERT_SUCCESS_MESSAGE', '{L_ALERT_USERS_GROUP_EDIT_SUCCESS}');
     }
 }
コード例 #7
0
ファイル: config.php プロジェクト: jankuca/geecms
include_once './app/subsystems/mysql.php';
include_once './app/subsystems/template.php';
include_once './app/subsystems/lang.php';
include_once './app/subsystems/modules.php';
// mysql: connection
$q->connect('localhost', 'blackpig', 'vGVbTen9y*:Ue7PW', 'blackpig');
$q->prefix = 'geecms_';
// mysql: select the configuration
$cfg = array();
$cfg['etc'] = array();
$cfg['tpl'] = array();
if (defined('IN_IMAGES') && IN_IMAGES) {
    $cfg['tpl']['images'] = array();
}
$sql = new MySQLObject();
$sql->query("SELECT `name`,`value`,`assign` FROM " . $q->table('config') . "");
foreach ($sql->fetch() as $item) {
    $cfg['etc'][$item->name] = $item->value;
    if (intval($item->assign) == true) {
        $tpl->assign($item->name, $item->value);
    }
}
unset($sql);
define('SITE_ROOT_PATH', $cfg['etc']['SITE_ROOT_PATH']);
// load the libraries
include_once './app/lib/pages.class.php';
include_once './app/lib/js/fckeditor/fckeditor.php';
// load all
$tpl->load_config();
$lang->load();
$mod->load();