OSDN Git Service

PDO対応
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / showlist.php
index b8760f9..ab78c23 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2006 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -13,9 +13,9 @@
  * Functions to create lists of things inside the admin are
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: showlist.php,v 1.4 2006-11-13 00:36:39 kimitake Exp $
- * @version $NucleusJP: showlist.php,v 1.3 2006/07/20 08:01:52 kimitake Exp $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id$
+ * @version $NucleusJP: showlist.php,v 1.7.2.3 2007/12/03 00:01:48 kmorimatsu Exp $
  */
 
 
@@ -41,18 +41,18 @@ function showlist($query, $type, $template) {
                $res = sql_query($query);
 
                // don't do anything if there are no results
-               $numrows = mysql_num_rows($res);
+               $numrows = sql_num_rows($res);
                if ($numrows == 0)
                        return 0;
 
                call_user_func('listplug_' . $type, $template, 'HEAD');
 
-               while($template['current'] = mysql_fetch_object($res))
+               while($template['current'] = sql_fetch_object($res))
                        call_user_func('listplug_' . $type, $template, 'BODY');
 
                call_user_func('listplug_' . $type, $template, 'FOOT');
 
-               mysql_free_result($res);
+               sql_free_result($res);
 
                // return amount of results
                return $numrows;
@@ -186,6 +186,7 @@ function listplug_table_pluginlist($template, $type) {
                                        echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';
                                        if ($plug->getURL())
                                        echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';
+//                                     echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">'.htmlspecialchars(shorten($plug->getURL(), 25, '...')),'</a><br />';
                                echo '</td>';
                                echo '<td>';
                                        echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
@@ -196,13 +197,36 @@ function listplug_table_pluginlist($template, $type) {
                                        if (!$plug->subscribtionListIsUptodate()) {
                                                echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';
                                        }
-                                       if (sizeof($plug->getPluginDep()) > 0)
+                                       if (sizeof($plug->getPluginDep()) > 0) {
                                                echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));
+                                       }
+// <add by shizuki>
+                               // check dependency require
+                               $req = array();
+                               $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));
+                               while($o = sql_fetch_object($res)) {
+                                       $preq =& $manager->getPlugin($o->pfile);
+                                       if ($preq) {
+                                               $depList = $preq->getPluginDep();
+                                               foreach ($depList as $depName) {
+                                                       if ($current->pfile == $depName) {
+                                                               $req[] = $o->pfile;
+                                                       }
+                                               }
+                                       }
+                               }
+                               if (count($req) > 0) {
+                                       echo '<h4 class="plugin_dependreq_title">' . _LIST_PLUGS_DEPREQ . "</h4>\n";
+                                       echo '<p class="plugin_dependreq_text">';
+                                       echo htmlspecialchars(implode(', ', $req), ENT_QUOTES);
+                                       echo "</p>\n";
+                               }
+// </add by shizuki>
                                echo '</td>';
                        } else {
-                               echo '<td colspan="2">Error: plugin file <b>',htmlspecialchars($current->pfile),'.php</b> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)</td>';
+                               echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, htmlspecialchars($current->pfile, ENT_QUOTES)) . '</td>';
                        }
-                       echo '<td>';
+                       echo '<td style="white-space:nowrap">';
 
                                $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';
                                $url = $manager->addTicketToUrl($baseUrl . 'pluginup');
@@ -249,7 +273,7 @@ function listplug_plugOptionRow($current) {
        $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
 
        // only if it is not a hidden option write the controls to the page
-       if ($meta['access'] != 'hidden') {
+       if (@$meta['access'] != 'hidden') {
                echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
                echo '<td>';
                switch($current['type']) {
@@ -274,7 +298,7 @@ function listplug_plugOptionRow($current) {
                        case 'textarea':
                                //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
                                echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';
-                               if ($meta['access'] == 'readonly') {
+                               if (@$meta['access'] == 'readonly') {
                                        echo ' readonly="readonly"';
                                }
                                echo '>',htmlspecialchars($current['value']),'</textarea>';
@@ -284,15 +308,15 @@ function listplug_plugOptionRow($current) {
                                //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
 
                                echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';
-                               if ($meta['datatype'] == 'numerical') {
+                               if (@$meta['datatype'] == 'numerical') {
                                        echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
                                }
-                               if ($meta['access'] == 'readonly') {
+                               if (@$meta['access'] == 'readonly') {
                                        echo ' readonly="readonly"';
                                }
                                echo ' />';
                }
-               echo $current['extra'];
+               echo @$current['extra'];
                echo '</td>';
        }
 }
@@ -335,10 +359,19 @@ function listplug_table_itemlist($template, $type) {
                        $current->ibody = strip_tags($current->ibody);
                        $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));
 
+                       $COMMENTS = new COMMENTS($current->inumber);
                        echo "$current->ibody</td>";
                        echo "<td  style=\"white-space:nowrap\" $cssclass>";
                        echo    "<a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a>";
-                       echo    "<br /><a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>"._LISTS_COMMENTS."</a>";
+                       // evaluate amount of comments for the item
+                       $camount = $COMMENTS->amountComments();
+                       if ($camount>0) {
+                               echo "<br /><a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>";
+                               echo "( " . sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments())." )</a>";
+                       }
+                       else {
+                               echo "<br />"._LIST_ITEM_NOCONTENT;
+                       }
                        echo    "<br /><a href='index.php?action=itemmove&amp;itemid=$current->inumber'>"._LISTS_MOVE."</a>";
                        echo    "<br /><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a>";
                        echo "</td>";
@@ -430,7 +463,7 @@ function listplug_table_bloglist($template, $type) {
 function listplug_table_shortblognames($template, $type) {
        switch($type) {
                case 'HEAD':
-                       echo "<th>" . _NAME . "</th><th>" . _NAME. "</th>";
+                       echo "<th>" . _EBLOG_SHORTNAME . "</th><th>" . _EBLOG_NAME. "</th>";
                        break;
                case 'BODY':
                        $current = $template['current'];
@@ -534,16 +567,19 @@ function listplug_table_skinlist($template, $type) {
 
                                $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
                                if ($hasEnlargement)
-                                       echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="View larger">';
+                                       echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';
 
-                               echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="Preview for \'',htmlspecialchars($current->sdname),'\' skin" />';
+                               $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));
+                               echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';
 
                                if ($hasEnlargement)
                                        echo '</a>';
 
                                if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
                                {
-                                       echo '<br /><a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'readme.html" title="More info on the \'',htmlspecialchars($current->sdname),'\' skin">Readme</a>';
+                                       $url         = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';
+                                       $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));
+                                       echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';
                                }
 
 
@@ -552,17 +588,21 @@ function listplug_table_skinlist($template, $type) {
                        echo "</td>";
 
 
-                       echo "<td>" , htmlspecialchars($current->sddesc);
+                       echo '<td class="availableSkinTypes">' . htmlspecialchars($current->sddesc);
                                // show list of defined parts
                                $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
                                $types = array();
-                               while ($o = mysql_fetch_object($r))
+                               while ($o = sql_fetch_object($r))
                                        array_push($types,$o->stype);
                                if (sizeof($types) > 0) {
                                        $friendlyNames = SKIN::getFriendlyNames();
                                        for ($i=0;$i<sizeof($types);$i++) {
                                                $type = $types[$i];
-                                               $types[$i] = '<li>' . helpHtml('skinpart'.$type) . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
+                                               if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
+                                                       $types[$i] = '<li>' . helpHtml('skinpart'.$type) . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
+                                               } else {
+                                                       $types[$i] = '<li>' . helpHtml('skinpartspecial') . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
+                                               }
                                        }
                                        echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
                                }