Exemplo n.º 1
0
 /**
  * Return array of all plugins based on plugin files on filesystem
  *
  * @param none
  * @return array
  */
 static function getAllPlugins()
 {
     trace(__FILE__, 'getAllPlugins()');
     $results = array();
     $dir = APPLICATION_PATH . '/plugins';
     $dirs = get_dirs($dir, false);
     foreach ((array) $dirs as $plugin) {
         if (file_exists($dir . '/' . $plugin . '/init.php') && is_file($dir . '/' . $plugin . '/init.php')) {
             $results[$plugin] = '-';
         }
     }
     // now sort by name
     ksort($results);
     // now get activated plugins
     $conditions = array('`installed` = 1');
     $plugins = Plugins::findAll(array('conditions' => $conditions));
     trace(__FILE__, 'getAllPlugins() - all plugins retrieved from database');
     foreach ((array) $plugins as $plugin) {
         trace(__FILE__, 'getAllPlugins() - foreach: ' . $plugin->getName());
         if (array_key_exists($plugin->getName(), $results)) {
             $results[$plugin->getName()] = $plugin->getPluginId();
         } else {
             // TODO : remove from DB here??
         }
     }
     return $results;
 }
Exemplo n.º 2
0
function get_dirs($startdir, $prefix = '/')
{
    $res = array();
    if (!is_dir($startdir)) {
        return;
    }
    global $showhiddenfiles;
    $dh = opendir($startdir);
    while (false !== ($entry = readdir($dh))) {
        if ($entry == '.') {
            continue;
        }
        $full = filemanager_utils::join_path($startdir, $entry);
        if (!is_dir($full)) {
            continue;
        }
        if (!$showhiddenfiles && ($entry[0] == '.' || $entry[0] == '_')) {
            continue;
        }
        if ($entry == '.svn' || $entry == '.git') {
            continue;
        }
        $res[$prefix . $entry] = $prefix . $entry;
        $tmp = get_dirs($full, $prefix . $entry . '/');
        if (is_array($tmp) && count($tmp)) {
            $res = array_merge($res, $tmp);
        }
    }
    closedir($dh);
    return $res;
}
Exemplo n.º 3
0
/**
 * Recursively lint the PHP scripts in a directory
 *
 * @param  string $dir Directory to scan recursively
 * @return void
 */
function lint_scripts_recursive($dir = __DIR__)
{
    static $funcs;
    if (is_null($funcs)) {
        $funcs = \shgysk8zer0\Core\NamespacedFunction::load(__NAMESPACE__);
    }
    array_map($funcs->lint_script, get_scripts($dir));
    array_map(__FUNCTION__, get_dirs($dir));
}
Exemplo n.º 4
0
function admin_gallery()
{
    global $db;
    $tpl = new smarty();
    $tpl->assign('access', get_form_rights());
    $tpl->assign('folders', get_dirs());
    $tpl->assign('lang', get_languages());
    $db->query('SELECT kateID, katename, galleries FROM ' . DB_PRE . 'ecp_gallery_kate ORDER BY katename ASC');
    $kate = array();
    while ($row = $db->fetch_assoc()) {
        @($options .= '<option value="' . $row['kateID'] . '">' . $row['katename'] . '</option>');
        $kate[] = $row;
    }
    $tplc = new Smarty();
    $tplc->assign('kate', $kate);
    ob_start();
    $tplc->display(DESIGN . '/tpl/admin/gallery_kate_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    $tpl->assign('kate', $content);
    $tpl->assign('kategorien', @$options);
    $db->query('SELECT galleryID, folder, name, images, katename FROM ' . DB_PRE . 'ecp_gallery LEFT JOIN ' . DB_PRE . 'ecp_gallery_kate ON cID = kateID ORDER BY name ASC');
    $gallery = array();
    while ($row = $db->fetch_assoc()) {
        $gallery[] = $row;
    }
    $tplc = new Smarty();
    $tplc->assign('gallery', $gallery);
    ob_start();
    $tplc->display(DESIGN . '/tpl/admin/gallery_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    $tpl->assign('gallery', $content);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/gallery.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(GALLERY, $content, '', 1);
}
Exemplo n.º 5
0
if (isset($_POST['action'])) {
    $gallery_folder = "../../upload/";
    $sg_path = $_POST['sg_path'];
    $sg_main_category = $_POST['sg_main_category'];
    $sg_twidth = $_POST['sg_twidth'];
    $sg_theight = $_POST['sg_theight'];
    $idWpisu = $_POST['idWpisu'];
    if ($_POST['action'] == "loadData") {
        $crumbs = get_crumbs($gallery_folder, $sg_main_category);
        $dirs = get_dirs($gallery_folder);
        $images = get_images($gallery_folder);
    } else {
        if ($_POST['action'] == "changeDir") {
            $newdir = $_POST['newdir'];
            $crumbs = get_crumbs($newdir, $sg_main_category);
            $dirs = get_dirs($newdir);
            $images = get_images($newdir);
        }
    }
    if ($sg_path == '') {
        echo '<script type="text/javascript" src="simplegallery/js/fancybox/jquery.fancybox.js?v=2.0.6"></script>';
        echo '<link rel="stylesheet" type="text/css" href="simplegallery/css/style.css" media="screen" />';
        echo '<link rel="stylesheet" type="text/css" href="simplegallery/js/fancybox/jquery.fancybox.css?v=2.0.6" media="screen" />';
    } else {
        echo '<script type="text/javascript" src="' . $sg_path . '/js/fancybox/jquery.fancybox.js?v=2.0.6"></script>';
        echo '<link rel="stylesheet" type="text/css" href="' . $sg_path . '/css/style.css" media="screen" />';
        echo '<link rel="stylesheet" type="text/css" href="' . $sg_path . '/js/fancybox/jquery.fancybox.css?v=2.0.6" media="screen" />';
    }
    if ($_POST['action'] == "changeDir") {
        echo '<script>sg_reload("' . $sg_path . '", "' . $sg_main_category . '", "' . $sg_twidth . '", "' . $sg_theight . '");</script>';
    }
Exemplo n.º 6
0
 /**
  * Load language settings
  *
  * @param void
  * @throws DirDnxError If language dir does not exists
  * @throws FileDnxError If language settings file for this local settings
  *   does not exists in lanuage dir
  */
 private function loadLanguageSettings()
 {
     trace(__FILE__, 'loadLanguageSettings()');
     // Check dir...
     $language_dir = $this->getLanguageDirPath();
     if (!is_dir($language_dir)) {
         throw new DirDnxError($language_dir);
     }
     // if
     $locale = $this->getLocale();
     $locale_dir = $language_dir . '/' . $locale;
     if (!is_dir($locale_dir)) {
         throw new DirDnxError($locale_dir);
     }
     // if
     // Get settings file path and include it
     $settings_file = $locale_dir . '/' . $locale . '.php';
     if (!is_file($settings_file)) {
         trace(__FILE__, 'loadLanguageSettings()');
         throw new FileDnxError($settings_file, "Failed to find language settings file" . $settings_file);
     }
     trace(__FILE__, 'loadLanguageSettings():include_once ' . $settings_file);
     include_once $settings_file;
     // Clear langs
     $this->langs->clear();
     // Load core language files
     $this->loadLanguageFiles($locale_dir);
     // load every plugin language files
     $dirs = get_dirs(PLUGINS_DIR, false);
     foreach ($dirs as $plugin_dir) {
         if (plugin_active($plugin_dir)) {
             // plugin_dir is same as plugin name
             $locale_dir = PLUGINS_DIR . '/' . $plugin_dir . '/language/' . $locale;
             if (is_dir($locale_dir)) {
                 $this->loadLanguageFiles($locale_dir);
             } else {
                 //$locale_dir = PLUGINS_DIR.'/'.$plugin_dir.'/language/en_us';
                 if (is_dir($locale_dir)) {
                     $this->loadLanguageFiles($locale_dir);
                 }
                 // if
             }
             // if
         }
         // if
     }
     // foreach
     // Done!
     return true;
 }
Exemplo n.º 7
0
$tpl_extension = isset($conf['extents_for_templates']) ? unserialize($conf['extents_for_templates']) : array();
$new_extensions = get_extents();
/* Selective URLs keyword */
$relevant_parameters = array('----------', 'category', 'favorites', 'most_visited', 'best_rated', 'recent_pics', 'recent_cats', 'created-monthly-calendar', 'posted-monthly-calendar', 'search', 'flat', 'list', 'tags');
$query = '
SELECT permalink
  FROM ' . CATEGORIES_TABLE . '
  WHERE permalink IS NOT NULL
';
/* Add active permalinks */
$permalinks = array_from_query($query, 'permalink');
$relevant_parameters = array_merge($relevant_parameters, $permalinks);
/* Link all supported templates to their respective handle */
$eligible_templates = array('----------' => 'N/A', 'about.tpl' => 'about', 'comments.tpl' => 'comments', 'comment_list.tpl' => 'comment_list', 'footer.tpl' => 'tail', 'header.tpl' => 'header', 'identification.tpl' => 'identification', 'index.tpl' => 'index', 'mainpage_categories.tpl' => 'index_category_thumbnails', 'menubar.tpl' => 'menubar', 'menubar_categories.tpl' => 'mbCategories', 'menubar_identification.tpl' => 'mbIdentification', 'menubar_links.tpl' => 'mbLinks', 'menubar_menu.tpl' => 'mbMenu', 'menubar_specials.tpl' => 'mbSpecials', 'menubar_tags.tpl' => 'mbTags', 'month_calendar.tpl' => 'month_calendar', 'navigation_bar.tpl' => 'navbar', 'nbm.tpl' => 'nbm', 'notification.tpl' => 'notification', 'password.tpl' => 'password', 'picture.tpl' => 'picture', 'picture_content.tpl' => 'default_content', 'picture_nav_buttons.tpl' => 'picture_nav_buttons', 'popuphelp.tpl' => 'popuphelp', 'profile.tpl' => 'profile', 'profile_content.tpl' => 'profile_content', 'redirect.tpl' => 'redirect', 'register.tpl' => 'register', 'search.tpl' => 'search', 'search_rules.tpl' => 'search_rules', 'slideshow.tpl' => 'slideshow', 'tags.tpl' => 'tags', 'thumbnails.tpl' => 'index_thumbnails');
$flip_templates = array_flip($eligible_templates);
$available_templates = array_merge(array('N/A' => '----------'), get_dirs(PHPWG_ROOT_PATH . 'themes'));
// +-----------------------------------------------------------------------+
// |                            selected templates                         |
// +-----------------------------------------------------------------------+
if (isset($_POST['submit'])) {
    $replacements = array();
    $i = 0;
    while (isset($_POST['reptpl'][$i])) {
        $newtpl = $_POST['reptpl'][$i];
        $original = $_POST['original'][$i];
        $handle = $eligible_templates[$original];
        $url_keyword = $_POST['url'][$i];
        if ($url_keyword == '----------') {
            $url_keyword = 'N/A';
        }
        $bound_tpl = $_POST['bound'][$i];
Exemplo n.º 8
0
<?php

require_once 'admin.inc.php';
$dirlist = explode(',', get_dirs(YIQIROOT . '/templets/'));
foreach ($dirlist as $dirinfo) {
    if ($dirinfo != '') {
        $doc = new DOMDocument();
        $configfile = YIQIROOT . '/templets/' . $dirinfo . '/config.xml';
        if (file_exists($configfile)) {
            $doc->load($configfile);
            $config = $doc->getElementsByTagName("yiqitemplet");
            $tempname = $config->item(0)->getElementsByTagName('name')->item(0)->nodeValue;
            $tempauthor = $config->item(0)->getElementsByTagName('author')->item(0)->nodeValue;
            $tempcopyright = $config->item(0)->getElementsByTagName('copyright')->item(0)->nodeValue;
            $temppubdate = $config->item(0)->getElementsByTagName('pubdate')->item(0)->nodeValue;
            if ($tempname != '' && $tempauthor != '') {
                //判断模板是否存在
                $sql = "select * from yiqi_templets where name = '{$tempname}' and directory = '{$dirinfo}' limit 1";
                if ($yiqi_db->query(CheckSql($sql)) == 0) {
                    //将不存在的模板添加到数据库
                    $sql = "insert into yiqi_templets(name,directory,thumb,author,copyright,adddate,status) values" . "('{$tempname}','{$dirinfo}','../templets/{$dirinfo}/preview.gif','{$tempauthor}','{$tempcopyright}','{$temppubdate}','ok')";
                    $yiqi_db->query(CheckSql($sql));
                }
            }
        }
    }
}
$tid = getset("sitetemplets")->value;
$sql = "select * from yiqi_templets where status = 'ok' order by tid";
$templetslist = $yiqi_db->get_results(CheckSql($sql));
$count = count($templetslist);
Exemplo n.º 9
0
            function switch_avatar_category(gallery)
            {
                if (gallery == "")
                    return;

                location.href = "<?php 
            echo JRoute::_(KUNENA_LIVEURLREL . '&func=myprofile&do=avatar&gallery=');
            ?>
"+gallery;
            }
                    //-->
        </script>

<?php 
            echo "<p align=\"center\">";
            get_dirs(KUNENA_PATH_UPLOADED . DS . 'avatars/gallery', "categoryid", $gallery);
            echo '<input type="button" value="' . _KUNENA_GO . '" class="button" onclick="switch_avatar_category(jQuery(\'#avatar_category_select\').val())" />' . "\n";
            echo "</p>";
            echo "<br />\n";
            echo '<form action="' . JRoute::_(KUNENA_LIVEURLREL . '&func=myprofile&do=avatar&action=gallery') . '" method="post" name="adminForm">';
            echo "<table width='100%' border='0' cellpadding='4' cellspacing='2'>";
            echo "<tr align='center' valign='middle'>";
            if ($gallery == "default") {
                $gallery = '';
            }
            $gallery1 = $gallery2 = '';
            if ($gallery) {
                $gallery1 = "/" . str_replace("%20", " ", $gallery);
                $gallery2 = str_replace("%20", " ", $gallery) . "/";
            }
            $avatar_gallery_path = KUNENA_PATH_UPLOADED . DS . 'avatars/gallery' . $gallery1;
Exemplo n.º 10
0
         $tmp_num_percent_1 = $percent[0] == 0 ? 0 : number_format($file_summary_array[$type[0]][1] * 100 / $percent[1], 2);
         echo '<tr>';
         echo '<td>' . $type[1] . '</td>';
         echo '<td>' . $file_summary_array[$type[0]][0] . '</td>';
         echo '<td>' . $tmp_num_percent_0 . '%</td>';
         echo '<td>' . $file_summary_array[$type[0]][1] . '</td>';
         echo '<td>' . $tmp_num_percent_1 . '%</td>';
         echo '</tr>';
     }
     echo '<tr><th>Files total</th><th>' . $percent[0] . '</th><th>100%</th><th>' . $percent[1] . '</th><th>100%</th></tr>';
     echo '</table>';
     echo gen_date($DBLANG);
     break;
 case 'files':
     // we need a dir to browse
     $dirs = get_dirs($dbhandle, $lang);
     $users = get_translators($dbhandle, $lang);
     if (empty($dirs)) {
         echo '<p>Error: no directories found in database.</p>';
         $sidebar = nav_tools($lang);
         site_footer($sidebar);
         die;
     }
     echo '<p>This tool allows you to check which files in your translation need update. To show the list ';
     echo 'choose a directory (it doesn\'t works recursively) or translator.</p>';
     echo '<p>When you click on the filename you will see plaintext diff showing changes between revisions so ';
     echo 'you will know what has changed in English version and what informations you need to update.';
     echo 'You can also click on [diff] to show colored diff.</p>';
     echo '<p>Choose a directory:</p>';
     echo '<form method="get" action="revcheck.php"><p><select name="dir">';
     foreach ($dirs as $id => $name) {
Exemplo n.º 11
0
/**
 * Recursively lint the PHP scripts in a directory
 *
 * @param  string $dir Directory to scan recursively
 * @return void
 */
function lint_scripts_recursive($dir = __DIR__)
{
    array_map(__NAMESPACE__ . '\\lint_script', get_scripts($dir));
    array_map(__FUNCTION__, get_dirs($dir));
}
Exemplo n.º 12
0
if ($newfile_page) {
    $filename = isset($_POST['tpl_name']) ? $_POST['tpl_name'] : '';
    $selected['model'] = isset($_POST['tpl_model']) ? $_POST['tpl_model'] : '0';
    $selected['parent'] = isset($_POST['tpl_parent']) ? $_POST['tpl_parent'] : PHPWG_ROOT_PATH . 'template-extension';
    // Parent directories list
    $options['parent'] = array(PHPWG_ROOT_PATH . 'template-extension' => 'template-extension');
    $options['parent'] = array_merge($options['parent'], get_rec_dirs(PHPWG_ROOT_PATH . 'template-extension'));
    $options['model'][] = l10n('locfiledit_empty_page');
    $options['model'][] = '----------------------';
    $i = 0;
    foreach (get_extents() as $pwg_template) {
        $value = PHPWG_ROOT_PATH . 'template-extension/' . $pwg_template;
        $options['model'][$value] = 'template-extension / ' . str_replace('/', ' / ', $pwg_template);
        $i++;
    }
    foreach (get_dirs($conf['themes_dir']) as $theme_id) {
        if ($i) {
            $options['model'][] = '----------------------';
            $i = 0;
        }
        $dir = $conf['themes_dir'] . '/' . $theme_id . '/template/';
        if (is_dir($dir) and $content = opendir($dir)) {
            while ($node = readdir($content)) {
                if (is_file($dir . $node) and get_extension($node) == 'tpl') {
                    $value = $dir . $node;
                    $options['model'][$value] = $theme_id . ' / ' . $node;
                    $i++;
                }
            }
        }
    }
Exemplo n.º 13
0
<?php

require 'functions.php';
write_header();
if (!isset($_REQUEST['dir']) || $_REQUEST['dir'] == "" || substr($_REQUEST['dir'], 0, 1) == "." || !is_dir(__DIR__ . '/' . PHOTOS_PATH . $_REQUEST['dir'])) {
    $_REQUEST['dir'] = "";
}
echo '<div class=gallery>';
if ($_REQUEST['dir'] !== "") {
    show_back(PHOTOS_PATH . $_REQUEST['dir']);
}
list_dirs(get_dirs($_REQUEST['dir']));
list_photos(get_images(PHOTOS_PATH . $_REQUEST['dir']));
echo '</div>';
Exemplo n.º 14
0
function get_dirs($dir)
{
    global $DOCDIR;
    // Collect files and diretcories in these arrays
    $directories = array();
    $files = array();
    // Open the directory
    $handle = @opendir($dir);
    // Walk through all names in the directory
    while ($file = @readdir($handle)) {
        if (!is_dir($dir . '/' . $file) && !in_array(substr($file, -3), array('xml', 'ent')) && substr($file, -13) != 'PHPEditBackup' || strpos($file, 'entities.') === 0 || $file == 'translation.xml' || $file == 'README' || $file == 'DO_NOT_TRANSLATE' || $file == 'rsusi.txt' || $file == 'missing-ids.xml' || $file == 'license.xml' || $file == 'versions.xml') {
            continue;
        }
        if ($file != '.' && $file != '..' && $file != '.svn' && $dir != '/functions') {
            if (is_dir($dir . '/' . $file)) {
                $directories[] = $file;
            } elseif (is_file($dir . '/' . $file)) {
                $files[] = $file;
            }
        }
    }
    // Close the directory
    @closedir($handle);
    // Sort files and directories
    sort($directories);
    sort($files);
    // Go through files first
    foreach ($files as $file) {
        change_revision($dir . $file);
    }
    // Then go through subdirectories
    foreach ($directories as $file) {
        get_dirs($dir . $file . '/');
    }
}
Exemplo n.º 15
0
                    $images .= '</a>';
                }
            }
            closedir($handle);
        }
    }
    return $images;
}
?>

<table style="width:100%">
	<tr>
		<td style="width:140px;vertical-align:top">
			<ul id="folder_list">
				<?php 
echo get_dirs();
?>
			</ul>
		</td>
		<td style="vertical-align:top">
			<div id="library_cont">
				<div class="info">Mappe: "<?php 
echo $_REQUEST['folder'];
?>
"</div>
					<?php 
echo get_images();
?>
			<div style="clear:both"></div>
			</div>
		</td>