Example #1
0
            if ($gallery->removeImage($filename)) {
                $result .= __('Image removed') . ': ' . $filename . '<br/>';
            } else {
                $result .= __('Error occurred') . ': ' . $filename . '<br/>';
            }
        }
    }
    $gallery->saveIndexFiles();
    if (!empty($result)) {
        rcms_showAdminMessage($result);
    }
}
/******************************************************************************
* Interface                                                                   *
******************************************************************************/
$files = $gallery->getFullImagesList();
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Uploaded images'));
if (!empty($files)) {
    $frm->addmessage(__('To divide keywords use ; symbol'));
    // Pagination
    if (!empty($system->config['perpage'])) {
        $perpage = $system->config['perpage'] * 3;
        $pages = ceil(sizeof($files) / $perpage);
        if (!empty($_GET['page']) && (int) $_GET['page'] > 0) {
            $page = (int) $_GET['page'] - 1;
        } else {
            $page = 0;
        }
        $start = $page * $perpage;
        $total = $perpage;
Example #2
0
function rcms_parse_dynamik_menu($format)
{
    global $system;
    function convertArray($ar)
    {
        $var = '{ ';
        foreach ($ar as $key => $val) {
            $var .= '"' . $key . '" : ';
            if (is_array($val)) {
                $var .= convertArray($val) . ', ';
            } else {
                $var .= '"' . $val . '", ';
            }
        }
        if ($var[strlen($var) - 2] == ',') {
            $var[strlen($var) - 2] = ' ';
        }
        return $var . '} ';
    }
    $pic_right = '&nbsp;&nbsp;<b>�</b> ';
    //Commented becouse f*****g IE, Microsoft, Gates and his mother...
    //$pic_right = '&nbsp;<img src = \''.SKIN_PATH.'arrow_right.gif\'>';
    //$pic_down = '<img src = \''.SKIN_PATH.'arrow_down.gif\'>';
    $pic_down = '';
    $navigation = parse_ini_file(CONFIG_PATH . 'navigation.ini', true);
    $dyna = parse_ini_file(CONFIG_PATH . 'dynamik.ini', true);
    $result = array();
    foreach ($navigation as $link) {
        if (substr($link['url'], 0, 9) == 'external:') {
            $target = '_blank';
            $link['url'] = substr($link['url'], 9);
        } else {
            $target = '';
        }
        $tdata = explode(':', $link['url'], 2);
        if (count($tdata) == 2) {
            list($modifier, $value) = $tdata;
        } else {
            $modifier = $tdata[0];
        }
        if (!empty($value) && !empty($system->navmodifiers[$modifier])) {
            if ($clink = call_user_func($system->navmodifiers[$modifier]['m'], $value)) {
                $result[] = array($clink[0], empty($link['name']) ? $clink[1] : __($link['name']), $target);
            }
        } else {
            $result[] = array($link['url'], __($link['name']));
        }
    }
    $menu = ' <script type="text/javascript" src="modules/jsc/navigation.js"></script> <div class="dhtml_menu"> <div class="horz_menu"> ';
    foreach ($result as $item) {
        if (empty($item[2])) {
            $item[2] = '_top';
        }
        if (empty($item[4])) {
            $item[4] = '';
        }
        // Begin of Icons support by Migel
        //$arr = array();
        if ($item[0] == '?module=articles') {
            if (!isset($dyna['use_art'])) {
                $articles = new articles();
                $containers = $articles->getContainers();
                $count = 0;
                if (is_array($containers)) {
                    $item[1] .= '&nbsp;' . $pic_down;
                    $containers = array_reverse($containers);
                    foreach ($containers as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_article']['&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '] = '?module=articles&c=' . $conkey;
                            if (!isset($dyna['min'])) {
                                $articles->setWorkContainer($conkey);
                                $art = $articles->getCategories();
                                $count2 = 0;
                                if (is_array($art)) {
                                    unset($arr['ddm_article']['&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']);
                                    $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '] = array('-' => '?module=articles&c=' . $conkey);
                                    $art = array_reverse($art);
                                    foreach ($art as $artkey => $artval) {
                                        $count2++;
                                        if ($count2 != $dyna['max']) {
                                            $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']['&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;'] = '?module=articles&c=' . $conkey . '&b=' . $artval['id'];
                                            $art2 = $articles->getArticles($artval['id']);
                                            $count3 = 0;
                                            if (count($art2) > 0) {
                                                unset($arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']['&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;']);
                                                $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '][$pic_right . '&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;'] = array('-' => '?module=articles&c=' . $conkey . '&b=' . $artval['id']);
                                                $art2 = array_reverse($art2);
                                                foreach ($art2 as $art2key => $art2val) {
                                                    $count3++;
                                                    if ($count3 != $dyna['max']) {
                                                        $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '][$pic_right . '&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($art2val['title']) . '&nbsp;&nbsp;'] = '?module=articles&c=' . $conkey . '&b=' . $artval['id'] . '&a=' . $art2val['id'];
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $item[4] = 'ddm_article';
            }
            $item[3] = 'articles.png';
        } elseif ($item[0] == '?module=gallery') {
            if (!isset($dyna['use_gal'])) {
                $gallery = new gallery();
                $kw = $gallery->getAvaiableValues('keywords');
                $count = 0;
                if (is_array($kw)) {
                    $kw = array_reverse($kw);
                    $count++;
                    if (!isset($dyna['min'])) {
                        foreach ($kw as $key => $val) {
                            if ($count != $dyna['max']) {
                                $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By keywords') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&keyword=' . $val);
                                $kw2 = $gallery->getLimitedImagesList('keywords', $val);
                                $kw2 = array_reverse($kw2);
                                $count2 = 0;
                                foreach ($kw2 as $key2 => $val2) {
                                    $count2++;
                                    if ($count2 != $dyna['max']) {
                                        $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By keywords') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
                                    }
                                }
                            }
                        }
                    }
                }
                $kw = $gallery->getAvaiableValues('size');
                $count = 0;
                if (is_array($kw)) {
                    $kw = array_reverse($kw);
                    $count++;
                    $item[1] .= '&nbsp;' . $pic_down;
                    if (!isset($dyna['min'])) {
                        foreach ($kw as $key => $val) {
                            if ($count != $dyna['max']) {
                                $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By size') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&size=' . $val);
                                $kw2 = $gallery->getLimitedImagesList('size', $val);
                                $kw2 = array_reverse($kw2);
                                $count2 = 0;
                                foreach ($kw2 as $key2 => $val2) {
                                    $count2++;
                                    if ($count2 != $dyna['max']) {
                                        $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By size') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
                                    }
                                }
                            }
                        }
                    }
                }
                $kw = $gallery->getAvaiableValues('type');
                $count = 0;
                if (is_array($kw)) {
                    $kw = array_reverse($kw);
                    $count++;
                    if (!isset($dyna['min'])) {
                        foreach ($kw as $key => $val) {
                            if ($count != $dyna['max']) {
                                $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By type') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&type=' . $val);
                                $kw2 = $gallery->getLimitedImagesList('type', $val);
                                $kw2 = array_reverse($kw2);
                                $count2 = 0;
                                foreach ($kw2 as $key2 => $val2) {
                                    $count2++;
                                    if ($count2 != $dyna['max']) {
                                        $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By type') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
                                    }
                                }
                            }
                        }
                    }
                }
                $kw = $gallery->getFullImagesList();
                $count = 0;
                if (count($kw) > 0) {
                    $kw = array_reverse($kw);
                    $count++;
                    foreach ($kw as $key => $val) {
                        if ($count != $dyna['max']) {
                            $arr['ddm_gallery']['&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val;
                        }
                    }
                }
                $item[4] = 'ddm_gallery';
            }
            $item[3] = 'gallery.png';
        } elseif ($item[0] == '?module=user.list') {
            if (!isset($dyna['use_mem'])) {
                $userlist = $system->getUserList('*', 'nickname');
                $count = 0;
                if (count($userlist) > 0) {
                    $item[1] .= '&nbsp;' . $pic_down;
                    $userlist = array_reverse($userlist);
                    foreach ($userlist as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_users']['&nbsp;&nbsp;' . cut_text($conval['nickname']) . '&nbsp;&nbsp;'] = '?module=user.list&user='******'username'];
                        }
                    }
                }
                $item[4] = 'ddm_users';
            }
            $item[3] = 'userlist.png';
        } elseif ($item[0] == '?module=filesdb') {
            if (!isset($dyna['use_fdb'])) {
                $filesdb = new linksdb(DOWNLOADS_DATAFILE);
                $count = 0;
                if (!empty($filesdb->data)) {
                    $item[1] .= '&nbsp;' . $pic_down;
                    $fdb = array_reverse($filesdb->data);
                    foreach ($fdb as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_filesdb']['&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;'] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1));
                            if (count($conval['files']) > 0) {
                                if (!isset($dyna['min'])) {
                                    unset($arr['ddm_filesdb']['&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;']);
                                    $arr['ddm_filesdb'][$pic_right . '&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;'] = array('-' => '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)));
                                    $count2 = 0;
                                    $conval['files'] = array_reverse($conval['files']);
                                    foreach ($conval['files'] as $artkey => $artval) {
                                        $count2++;
                                        if ($count2 != $dyna['max']) {
                                            $arr['ddm_filesdb'][$pic_right . '&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($artval['name']) . '&nbsp;&nbsp;'] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)) . '&fid=' . (sizeof($conval['files']) - ($count2 - 1));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $item[4] = 'ddm_filesdb';
            }
            $item[3] = 'files.png';
        } elseif ($item[0] == '?module=forum') {
            if (!isset($dyna['use_for'])) {
                $topics = @unserialize(@file_get_contents(FORUM_PATH . 'topic_index.dat'));
                $count = 0;
                if (count($topics) > 0) {
                    $item[1] .= '&nbsp;' . $pic_down;
                    if (is_array($topics)) {
                        $topics = array_reverse($topics);
                        foreach ($topics as $conkey => $conval) {
                            $count++;
                            if ($count != $dyna['max']) {
                                $arr['ddm_forum']['&nbsp;&nbsp;' . cut_text($conval['title']) . '&nbsp;&nbsp;'] = '?module=forum&id=' . (sizeof($topics) - $count) . '&action=topic';
                            }
                        }
                    }
                }
                $item[4] = 'ddm_forum';
            }
            $item[3] = 'forum.png';
        } elseif ($item[1] == 'CUSTOM1') {
            $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_1.txt')) . '&nbsp;' . $pic_down;
            $arr['ddm_custom1'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_1.dat')));
            $item[4] = 'ddm_custom1';
            $item[3] = 'custom1.png';
        } elseif ($item[1] == 'CUSTOM2') {
            $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_2.txt')) . '&nbsp;' . $pic_down;
            $arr['ddm_custom2'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_2.dat')));
            $item[4] = 'ddm_custom2';
            $item[3] = 'custom2.png';
        } elseif ($item[1] == 'CUSTOM3') {
            $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_3.txt')) . '&nbsp;' . $pic_down;
            $arr['ddm_custom3'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_3.dat')));
            $item[4] = 'ddm_custom3';
            $item[3] = 'custom3.png';
        } else {
            $item[3] = 'default.png';
        }
        if (isset($dyna['ico'])) {
            $item[3] = '<img src="skins/icons/' . $item[3] . '">';
        } else {
            $item[3] = '';
        }
        $menu .= str_replace('{link}', $item[0], str_replace('{title}', $item[1], str_replace('{target}', @$item[2], str_replace('{icon}', $item[3], str_replace('{id}', $item[4], $format)))));
        // End of Icons support by Migel
    }
    $menu .= ' <br clear="both" /> </div>';
    $result = $menu . ' <script type="text/javascript"> dhtmlmenu_build(' . convertArray($arr, 'arr') . ');</script></div>';
    return $result;
}
Example #3
0
     $images_t = $gallery->getLimitedImagesList('type', $_GET['type']);
     $images = array();
     foreach ($images_s as $image) {
         if (in_array($image, $images_t)) {
             $images[] = $image;
         }
     }
     $linkdata .= '&amp;size=' . $_GET['size'] . '&amp;type=' . $_GET['type'];
 } elseif (!empty($_GET['size'])) {
     $images = $gallery->getLimitedImagesList('size', $_GET['size']);
     $linkdata .= '&amp;size=' . $_GET['size'];
 } elseif (!empty($_GET['type'])) {
     $images = $gallery->getLimitedImagesList('type', $_GET['type']);
     $linkdata .= '&amp;type=' . $_GET['type'];
 } else {
     $images = $gallery->getFullImagesList();
 }
 if (!empty($_GET['keyword'])) {
     $images_k = $gallery->getLimitedImagesList('keywords', $_GET['keyword']);
     $images_a = $images;
     $images = array();
     foreach ($images_k as $image) {
         if (in_array($image, $images_a)) {
             $images[] = $image;
         }
     }
     $linkdata .= '&amp;keyword=' . $_GET['keyword'];
 }
 if (!empty($images)) {
     $imagesf = array_flip($images);
     arsort($imagesf);