OSDN Git Service

CHANGE: SQL92標準に合わせてINSERT文を変更。
authorsakamocchi <o-takashi@sakamocchi.jp>
Wed, 29 Feb 2012 14:07:10 +0000 (23:07 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Wed, 29 Feb 2012 14:07:10 +0000 (23:07 +0900)
http://dev.mysql.com/doc/refman/5.1/ja/extensions-to-ansi.html
以下の文はMySQL拡張なので修正。
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
    [INTO] tbl_name
    SET col_name={expr | DEFAULT}, ...
    [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]

nucleus/convert/wordpress.php
nucleus/libs/ACTIONLOG.php
nucleus/libs/ADMIN.php
nucleus/libs/BAN.php
nucleus/libs/BLOG.php
nucleus/libs/SKIN.php
nucleus/libs/TEMPLATE.php

index d458cc1..93d8da4 100644 (file)
@@ -166,7 +166,7 @@ a:hover{text-decoration:underline}
         echo $total_num.", ";
                $cate_map[$row->term_id] = $total_num;
         $query=
-          "insert into " . sql_table('category') .
+          "INSERT INTO " . sql_table('category') .
           " (catid,cblog,cname,cdesc)  values (".
           intval($total_num).",1,'".encoding($row->name)."','@wordpress')";
         $result = mysql_query($query,$linkblogcms) or die($query);
@@ -193,7 +193,7 @@ a:hover{text-decoration:underline}
 
         // insert post
         $query=
-          "insert into " . sql_table('item') . " ".
+          "INSERT INTO " . sql_table('item') . " ".
           "(ititle,ibody,iblog,iauthor,itime,icat) values (".
           "'".addslashes(encoding($row->post_title))."','".addslashes(paragraph(encoding(stripslashes($row->post_content)),false))."',1,1,'".$row->post_date."',$cat)";
         $result = mysql_query($query,$linkblogcms) or die($query);
@@ -206,7 +206,7 @@ a:hover{text-decoration:underline}
           $url=$row_detail->comment_author_email;
           if (!empty($row_detail->comment_author_url)) $url=$row_detail->comment_author_url;
           $query=
-            "insert into " . sql_table('comment') .
+            "INSERT INTO " . sql_table('comment') .
             " (cbody,cuser,cmail,cmember,citem,ctime,cip,cblog,chost) values (".
               "'".addslashes(paragraph(encoding(strip_tags(stripslashes($row_detail->comment_content))),true))."',".
               "'".encoding($row_detail->comment_author)."',".
index 32b0053..cac2c53 100644 (file)
@@ -22,29 +22,42 @@ define('INFO',3);           // info, errors and warnings
 define('DEBUG',4);             // everything
 $CONF['LogLevel'] = INFO;
 
-class ACTIONLOG {
-
+class ACTIONLOG
+{
        /**
-         * (Static) Method to add a message to the action log
-         */
-       function add($level, $message) {
+        * ACTIONLOG::add()
+        * Method to add a message to the action log
+        * 
+        * @static
+        * @param       Integer $level  log level
+        * @param       String  $message        log message
+        * @return      
+        * 
+        */
+       function add($level, $message)
+       {
                global $member, $CONF;
-
-               if ($CONF['LogLevel'] < $level)
+               
+               if ( $CONF['LogLevel'] < $level )
+               {
                        return;
-
-               if ($member && $member->isLoggedIn())
+               }
+               
+               if ( $member && $member->isLoggedIn() )
+               {
                        $message = "[" . $member->getDisplayName() . "] " . $message;
-
+               }
+               
                $message = sql_real_escape_string($message);            // add slashes
                $timestamp = date("Y-m-d H:i:s",time());        // format timestamp
-               $query = "INSERT INTO " . sql_table('actionlog') . " (timestamp, message) VALUES ('$timestamp', '$message')";
-
+               $query = "INSERT INTO %s (timestamp, message) VALUES ('%s', '%s')";
+               $query = sprintf($query, sql_table('actionlog'), $timestamp, $message);
                sql_query($query);
-
-               ACTIONLOG::trimLog();
+               
+               self::trimLog();
+               return;
        }
-
+       
        /**
          * (Static) Method to clear the whole action log
          */
index 061eadb..b774d97 100644 (file)
@@ -4043,24 +4043,32 @@ selector();
 
     }
 
-    /**
-     * @todo document this
-     */
-    function addToTemplate($id, $partname, $content) {
-        $partname = sql_real_escape_string($partname);
-        $content = sql_real_escape_string($content);
-
-        $id = intval($id);
-
-        // don't add empty parts:
-        if (!trim($content)) return -1;
-
-        $query = 'INSERT INTO '.sql_table('template')." (tdesc, tpartname, tcontent) "
-               . "VALUES ($id, '$partname', '$content')";
-        sql_query($query) or exit(_ADMIN_SQLDIE_QUERYERROR . sql_error());
-        return sql_insert_id();
-    }
-
+       /**
+        * ADMIN::addToTemplate()
+        * 
+        * @param       Integer $id     ID for template
+        * @param       String  $partname       parts name
+        * @param       String  $content        template contents
+        * @return      Integer record index
+        * 
+        */
+       function addToTemplate($id, $partname, $content)
+       {
+               // don't add empty parts:
+               if ( !trim($content) )
+               {
+                       return -1;
+               }
+               
+               $partname = sql_real_escape_string($partname);
+               $content = sql_real_escape_string($content);
+               
+               $query = "INSERT INTO %s (tdesc, tpartname, tcontent) VALUES (%d, '%s', '%s')";
+               $query = sprintf($query, sql_table('template'), (integer) $id, $partname, $content);
+               sql_query($query) or exit(_ADMIN_SQLDIE_QUERYERROR . sql_error());
+               return sql_insert_id();
+       }
+       
     /**
      * @todo document this
      */
@@ -4677,91 +4685,104 @@ selector();
 
     }
 
-    /**
-     * @todo document this
-     */
-    function skinclonetype($skin, $newid, $type) {
-        $newid = intval($newid);
-        $content = $skin->getContent($type);
-        if ($content) {
-            $query = 'INSERT INTO '.sql_table('skin')." (sdesc, scontent, stype) VALUES ($newid,'". sql_real_escape_string($content)."', '". sql_real_escape_string($type)."')";
-            sql_query($query);
-        }
-    }
-
-    /**
-     * @todo document this
-     */
-    function action_settingsedit() {
-        global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;
+       /**
+        * ADMIN::skinclonetype()
+        * 
+        * @param       String  $skin   Skin object
+        * @param       Integer $newid  ID for this clone
+        * @param       String  $type   type of skin
+        * @return      Void
+        */
+       function skinclonetype($skin, $newid, $type)
+       {
+               $newid = intval($newid);
+               $content = $skin->getContent($type);
+               
+               if ( $content )
+               {
+                       $query = "INSERT INTO %s (sdesc, scontent, stype) VALUES (%d, '%s', '%s')";
+                       $query = sprintf($query, sql_table('skin'), (integer) $newid, $content, $type);
+                       sql_query($query);
+               }
+               return;
+       }
+       
+       /**
+        * ADMIN::action_settingsedit()
+        * 
+        * @param       Void
+        * @return      Void
+        */
+       function action_settingsedit() {
+               global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;
 
-        $member->isAdmin() or $this->disallow();
+               $member->isAdmin() or $this->disallow();
 
-        $this->pagehead();
+               $this->pagehead();
 
-        echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
-        ?>
+               echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
+               ?>
 
-        <h2><?php echo _SETTINGS_TITLE?></h2>
+               <h2><?php echo _SETTINGS_TITLE?></h2>
 
-        <form action="index.php" method="post">
-        <div>
+               <form action="index.php" method="post">
+               <div>
 
-        <input type="hidden" name="action" value="settingsupdate" />
-        <?php $manager->addTicketHidden() ?>
+               <input type="hidden" name="action" value="settingsupdate" />
+               <?php $manager->addTicketHidden() ?>
 
-        <table><tr>
-            <th colspan="2"><?php echo _SETTINGS_SUB_GENERAL?></th>
-        </tr><tr>
-            <td><?php echo _SETTINGS_DEFBLOG?> <?php help('defaultblog'); ?></td>
-            <td>
-                <?php
-                    $query =  'SELECT bname as text, bnumber as value'
-                           . ' FROM '.sql_table('blog');
-                    $template['name'] = 'DefaultBlog';
-                    $template['selected'] = $CONF['DefaultBlog'];
-                    $template['tabindex'] = 10;
-                    showlist($query,'select',$template);
-                ?>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_BASESKIN?> <?php help('baseskin'); ?></td>
-            <td>
-                <?php
-                    $query =  'SELECT sdname as text, sdnumber as value'
-                           . ' FROM '.sql_table('skin_desc');
-                    $template['name'] = 'BaseSkin';
-                    $template['selected'] = $CONF['BaseSkin'];
-                    $template['tabindex'] = 1;
-                    showlist($query,'select',$template);
-                ?>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_ADMINMAIL?></td>
-            <td><input name="AdminEmail" tabindex="10010" size="40" value="<?php echo  ENTITY::hsc($CONF['AdminEmail']) ?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_SITENAME?></td>
-            <td><input name="SiteName" tabindex="10020" size="40" value="<?php echo  ENTITY::hsc($CONF['SiteName']) ?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_SITEURL?></td>
-            <td><input name="IndexURL" tabindex="10030" size="40" value="<?php echo  ENTITY::hsc($CONF['IndexURL']) ?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_ADMINURL?></td>
-            <td><input name="AdminURL" tabindex="10040" size="40" value="<?php echo  ENTITY::hsc($CONF['AdminURL']) ?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_PLUGINURL?> <?php help('pluginurl');?></td>
-            <td><input name="PluginURL" tabindex="10045" size="40" value="<?php echo  ENTITY::hsc($CONF['PluginURL']) ?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_SKINSURL?> <?php help('skinsurl');?></td>
-            <td><input name="SkinsURL" tabindex="10046" size="40" value="<?php echo  ENTITY::hsc($CONF['SkinsURL']) ?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_ACTIONSURL?> <?php help('actionurl');?></td>
-            <td><input name="ActionURL" tabindex="10047" size="40" value="<?php echo  ENTITY::hsc($CONF['ActionURL']) ?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_LOCALE?> <?php help('locale'); ?>
-            </td>
-            <td>
-                <select name="Locale" tabindex="10050">
+               <table><tr>
+                       <th colspan="2"><?php echo _SETTINGS_SUB_GENERAL?></th>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_DEFBLOG?> <?php help('defaultblog'); ?></td>
+                       <td>
+                               <?php
+                                       $query =  'SELECT bname as text, bnumber as value'
+                                                  . ' FROM '.sql_table('blog');
+                                       $template['name'] = 'DefaultBlog';
+                                       $template['selected'] = $CONF['DefaultBlog'];
+                                       $template['tabindex'] = 10;
+                                       showlist($query,'select',$template);
+                               ?>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_BASESKIN?> <?php help('baseskin'); ?></td>
+                       <td>
+                               <?php
+                                       $query =  'SELECT sdname as text, sdnumber as value'
+                                                  . ' FROM '.sql_table('skin_desc');
+                                       $template['name'] = 'BaseSkin';
+                                       $template['selected'] = $CONF['BaseSkin'];
+                                       $template['tabindex'] = 1;
+                                       showlist($query,'select',$template);
+                               ?>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_ADMINMAIL?></td>
+                       <td><input name="AdminEmail" tabindex="10010" size="40" value="<?php echo  ENTITY::hsc($CONF['AdminEmail']) ?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_SITENAME?></td>
+                       <td><input name="SiteName" tabindex="10020" size="40" value="<?php echo  ENTITY::hsc($CONF['SiteName']) ?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_SITEURL?></td>
+                       <td><input name="IndexURL" tabindex="10030" size="40" value="<?php echo  ENTITY::hsc($CONF['IndexURL']) ?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_ADMINURL?></td>
+                       <td><input name="AdminURL" tabindex="10040" size="40" value="<?php echo  ENTITY::hsc($CONF['AdminURL']) ?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_PLUGINURL?> <?php help('pluginurl');?></td>
+                       <td><input name="PluginURL" tabindex="10045" size="40" value="<?php echo  ENTITY::hsc($CONF['PluginURL']) ?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_SKINSURL?> <?php help('skinsurl');?></td>
+                       <td><input name="SkinsURL" tabindex="10046" size="40" value="<?php echo  ENTITY::hsc($CONF['SkinsURL']) ?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_ACTIONSURL?> <?php help('actionurl');?></td>
+                       <td><input name="ActionURL" tabindex="10047" size="40" value="<?php echo  ENTITY::hsc($CONF['ActionURL']) ?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_LOCALE?> <?php help('locale'); ?>
+                       </td>
+                       <td>
+                               <select name="Locale" tabindex="10050">
                        <?php
                                $locales = i18n::get_available_locale_list();
                                if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
@@ -4791,90 +4812,90 @@ selector();
                        ?>
                        </select>
 
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_DISABLESITE?> <?php help('disablesite'); ?>
-            </td>
-            <td><?php $this->input_yesno('DisableSite',$CONF['DisableSite'],10060); ?>
-                    <br />
-                <?php echo _SETTINGS_DISABLESITEURL ?> <input name="DisableSiteURL" tabindex="10070" size="40" value="<?php echo  ENTITY::hsc($CONF['DisableSiteURL'])?>" />
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_DIRS?></td>
-            <td><?php echo  ENTITY::hsc($DIR_NUCLEUS) ?>
-                <i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_DBLOGIN?></td>
-            <td><i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
-        </tr><tr>
-            <td>
-            <?php
-                echo _SETTINGS_JSTOOLBAR
-                /* =_SETTINGS_DISABLEJS
-
-                    I temporary changed the meaning of DisableJsTools, until I can find a good
-                    way to select the javascript version to use
-
-                    now, its:
-                        0 : IE
-                        1 : all javascript disabled
-                        2 : 'simpler' javascript (for mozilla/opera/mac)
-                */
-               ?>
-            </td>
-            <td><?php /* $this->input_yesno('DisableJsTools',$CONF['DisableJsTools'],10075); */?>
-                <select name="DisableJsTools" tabindex="10075">
-            <?php                   $extra = ($CONF['DisableJsTools'] == 1) ? 'selected="selected"' : '';
-                    echo "<option $extra value='1'>",_SETTINGS_JSTOOLBAR_NONE,"</option>";
-                    $extra = ($CONF['DisableJsTools'] == 2) ? 'selected="selected"' : '';
-                    echo "<option $extra value='2'>",_SETTINGS_JSTOOLBAR_SIMPLE,"</option>";
-                    $extra = ($CONF['DisableJsTools'] == 0) ? 'selected="selected"' : '';
-                    echo "<option $extra value='0'>",_SETTINGS_JSTOOLBAR_FULL,"</option>";
-            ?>
-                </select>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_URLMODE?> <?php help('urlmode');?></td>
-                       <td><?php
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_DISABLESITE?> <?php help('disablesite'); ?>
+                       </td>
+                       <td><?php $this->input_yesno('DisableSite',$CONF['DisableSite'],10060); ?>
+                                       <br />
+                               <?php echo _SETTINGS_DISABLESITEURL ?> <input name="DisableSiteURL" tabindex="10070" size="40" value="<?php echo  ENTITY::hsc($CONF['DisableSiteURL'])?>" />
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_DIRS?></td>
+                       <td><?php echo  ENTITY::hsc($DIR_NUCLEUS) ?>
+                               <i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_DBLOGIN?></td>
+                       <td><i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
+               </tr><tr>
+                       <td>
+                       <?php
+                               echo _SETTINGS_JSTOOLBAR
+                               /* =_SETTINGS_DISABLEJS
+
+                                       I temporary changed the meaning of DisableJsTools, until I can find a good
+                                       way to select the javascript version to use
+
+                                       now, its:
+                                               0 : IE
+                                               1 : all javascript disabled
+                                               2 : 'simpler' javascript (for mozilla/opera/mac)
+                               */
+                          ?>
+                       </td>
+                       <td><?php /* $this->input_yesno('DisableJsTools',$CONF['DisableJsTools'],10075); */?>
+                               <select name="DisableJsTools" tabindex="10075">
+                       <?php                              $extra = ($CONF['DisableJsTools'] == 1) ? 'selected="selected"' : '';
+                                       echo "<option $extra value='1'>",_SETTINGS_JSTOOLBAR_NONE,"</option>";
+                                       $extra = ($CONF['DisableJsTools'] == 2) ? 'selected="selected"' : '';
+                                       echo "<option $extra value='2'>",_SETTINGS_JSTOOLBAR_SIMPLE,"</option>";
+                                       $extra = ($CONF['DisableJsTools'] == 0) ? 'selected="selected"' : '';
+                                       echo "<option $extra value='0'>",_SETTINGS_JSTOOLBAR_FULL,"</option>";
+                       ?>
+                               </select>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_URLMODE?> <?php help('urlmode');?></td>
+                                          <td><?php
 
-                       $this->input_yesno('URLMode',$CONF['URLMode'],10077,
-                              'normal','pathinfo',_SETTINGS_URLMODE_NORMAL,_SETTINGS_URLMODE_PATHINFO);
+                                          $this->input_yesno('URLMode',$CONF['URLMode'],10077,
+                                                         'normal','pathinfo',_SETTINGS_URLMODE_NORMAL,_SETTINGS_URLMODE_PATHINFO);
 
-                       echo ' ', _SETTINGS_URLMODE_HELP;
+                                          echo ' ', _SETTINGS_URLMODE_HELP;
 
-                             ?>
+                                                        ?>
 
-                       </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_DEBUGVARS?> <?php help('debugvars');?></td>
-                       <td><?php
+                                          </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_DEBUGVARS?> <?php help('debugvars');?></td>
+                                          <td><?php
 
-                        $this->input_yesno('DebugVars',$CONF['DebugVars'],10078);
+                                               $this->input_yesno('DebugVars',$CONF['DebugVars'],10078);
 
-                             ?>
+                                                        ?>
 
-                       </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_DEFAULTLISTSIZE?> <?php help('defaultlistsize');?></td>
-            <td>
-            <?php
-                if (!array_key_exists('DefaultListSize',$CONF)) {
-                    sql_query("INSERT INTO ".sql_table('config')." VALUES ('DefaultListSize', '10')");
-                    $CONF['DefaultListSize'] = 10;
-                }
-            ?>
-                <input name="DefaultListSize" tabindex="10079" size="40" value="<?php echo  ENTITY::hsc((intval($CONF['DefaultListSize']) < 1 ? '10' : $CONF['DefaultListSize'])) ?>" />
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_ADMINCSS?> 
-            </td>
-            <td>
+                                          </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_DEFAULTLISTSIZE?> <?php help('defaultlistsize');?></td>
+                       <td>
+                       <?php
+                               if (!array_key_exists('DefaultListSize',$CONF)) {
+                                       sql_query("INSERT INTO ".sql_table('config')." VALUES ('DefaultListSize', '10')");
+                                       $CONF['DefaultListSize'] = 10;
+                               }
+                       ?>
+                               <input name="DefaultListSize" tabindex="10079" size="40" value="<?php echo  ENTITY::hsc((intval($CONF['DefaultListSize']) < 1 ? '10' : $CONF['DefaultListSize'])) ?>" />
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_ADMINCSS?> 
+                       </td>
+                       <td>
 
-                <select name="AdminCSS" tabindex="10080">
-                <?php               // show a dropdown list of all available admin css files
-                global $DIR_NUCLEUS;
+                               <select name="AdminCSS" tabindex="10080">
+                               <?php                      // show a dropdown list of all available admin css files
+                               global $DIR_NUCLEUS;
                                
-                $dirhandle = opendir($DIR_NUCLEUS."styles/");
+                               $dirhandle = opendir($DIR_NUCLEUS."styles/");
 
                                while ($filename = readdir($dirhandle) )
                                {
@@ -4904,127 +4925,127 @@ selector();
                                ?>
                                </select>
 
-            </td>
-        </tr><tr>
-            <th colspan="2"><?php echo _SETTINGS_MEDIA?> <?php help('media'); ?></th>
-        </tr><tr>
-            <td><?php echo _SETTINGS_MEDIADIR?></td>
-            <td><?php echo  ENTITY::hsc($DIR_MEDIA) ?>
-                <i><?php echo _SETTINGS_SEECONFIGPHP?></i>
-                <?php                   if (!is_dir($DIR_MEDIA))
-                        echo "<br /><b>" . _WARNING_NOTADIR . "</b>";
-                    if (!is_readable($DIR_MEDIA))
-                        echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>";
-                    if (!is_writeable($DIR_MEDIA))
-                        echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>";
-                ?>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_MEDIAURL?></td>
-            <td>
-                <input name="MediaURL" tabindex="10090" size="40" value="<?php echo  ENTITY::hsc($CONF['MediaURL']) ?>" />
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_ALLOWUPLOAD?></td>
-            <td><?php $this->input_yesno('AllowUpload',$CONF['AllowUpload'],10090); ?></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_ALLOWUPLOADTYPES?></td>
-            <td>
-                <input name="AllowedTypes" tabindex="10100" size="40" value="<?php echo  ENTITY::hsc($CONF['AllowedTypes']) ?>" />
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_MAXUPLOADSIZE?></td>
-            <td>
-                <input name="MaxUploadSize" tabindex="10105" size="40" value="<?php echo  ENTITY::hsc($CONF['MaxUploadSize']) ?>" />
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_MEDIAPREFIX?></td>
-            <td><?php $this->input_yesno('MediaPrefix',$CONF['MediaPrefix'],10110); ?></td>
-
-        </tr><tr>
-            <th colspan="2"><?php echo _SETTINGS_MEMBERS?></th>
-        </tr><tr>
-            <td><?php echo _SETTINGS_CHANGELOGIN?></td>
-            <td><?php $this->input_yesno('AllowLoginEdit',$CONF['AllowLoginEdit'],10120); ?></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_ALLOWCREATE?>
-                <?php help('allowaccountcreation'); ?>
-            </td>
-            <td><?php $this->input_yesno('AllowMemberCreate',$CONF['AllowMemberCreate'],10130); ?>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_NEWLOGIN?> <?php help('allownewmemberlogin'); ?>
-                <br /><?php echo _SETTINGS_NEWLOGIN2?>
-            </td>
-            <td><?php $this->input_yesno('NewMemberCanLogon',$CONF['NewMemberCanLogon'],10140); ?>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_MEMBERMSGS?>
-                <?php help('messageservice'); ?>
-            </td>
-            <td><?php $this->input_yesno('AllowMemberMail',$CONF['AllowMemberMail'],10150); ?>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_NONMEMBERMSGS?>
-                <?php help('messageservice'); ?>
-            </td>
-            <td><?php $this->input_yesno('NonmemberMail',$CONF['NonmemberMail'],10155); ?>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_PROTECTMEMNAMES?>
-                <?php help('protectmemnames'); ?>
-            </td>
-            <td><?php $this->input_yesno('ProtectMemNames',$CONF['ProtectMemNames'],10156); ?>
-            </td>
+                       </td>
+               </tr><tr>
+                       <th colspan="2"><?php echo _SETTINGS_MEDIA?> <?php help('media'); ?></th>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_MEDIADIR?></td>
+                       <td><?php echo  ENTITY::hsc($DIR_MEDIA) ?>
+                               <i><?php echo _SETTINGS_SEECONFIGPHP?></i>
+                               <?php                              if (!is_dir($DIR_MEDIA))
+                                               echo "<br /><b>" . _WARNING_NOTADIR . "</b>";
+                                       if (!is_readable($DIR_MEDIA))
+                                               echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>";
+                                       if (!is_writeable($DIR_MEDIA))
+                                               echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>";
+                               ?>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_MEDIAURL?></td>
+                       <td>
+                               <input name="MediaURL" tabindex="10090" size="40" value="<?php echo  ENTITY::hsc($CONF['MediaURL']) ?>" />
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_ALLOWUPLOAD?></td>
+                       <td><?php $this->input_yesno('AllowUpload',$CONF['AllowUpload'],10090); ?></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_ALLOWUPLOADTYPES?></td>
+                       <td>
+                               <input name="AllowedTypes" tabindex="10100" size="40" value="<?php echo  ENTITY::hsc($CONF['AllowedTypes']) ?>" />
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_MAXUPLOADSIZE?></td>
+                       <td>
+                               <input name="MaxUploadSize" tabindex="10105" size="40" value="<?php echo  ENTITY::hsc($CONF['MaxUploadSize']) ?>" />
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_MEDIAPREFIX?></td>
+                       <td><?php $this->input_yesno('MediaPrefix',$CONF['MediaPrefix'],10110); ?></td>
 
+               </tr><tr>
+                       <th colspan="2"><?php echo _SETTINGS_MEMBERS?></th>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_CHANGELOGIN?></td>
+                       <td><?php $this->input_yesno('AllowLoginEdit',$CONF['AllowLoginEdit'],10120); ?></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_ALLOWCREATE?>
+                               <?php help('allowaccountcreation'); ?>
+                       </td>
+                       <td><?php $this->input_yesno('AllowMemberCreate',$CONF['AllowMemberCreate'],10130); ?>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_NEWLOGIN?> <?php help('allownewmemberlogin'); ?>
+                               <br /><?php echo _SETTINGS_NEWLOGIN2?>
+                       </td>
+                       <td><?php $this->input_yesno('NewMemberCanLogon',$CONF['NewMemberCanLogon'],10140); ?>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_MEMBERMSGS?>
+                               <?php help('messageservice'); ?>
+                       </td>
+                       <td><?php $this->input_yesno('AllowMemberMail',$CONF['AllowMemberMail'],10150); ?>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_NONMEMBERMSGS?>
+                               <?php help('messageservice'); ?>
+                       </td>
+                       <td><?php $this->input_yesno('NonmemberMail',$CONF['NonmemberMail'],10155); ?>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_PROTECTMEMNAMES?>
+                               <?php help('protectmemnames'); ?>
+                       </td>
+                       <td><?php $this->input_yesno('ProtectMemNames',$CONF['ProtectMemNames'],10156); ?>
+                       </td>
 
 
-        </tr><tr>
-            <th colspan="2"><?php echo _SETTINGS_COOKIES_TITLE?> <?php help('cookies'); ?></th>
-        </tr><tr>
-            <td><?php echo _SETTINGS_COOKIEPREFIX?></td>
-            <td><input name="CookiePrefix" tabindex="10159" size="40" value="<?php echo  ENTITY::hsc($CONF['CookiePrefix'])?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_COOKIEDOMAIN?></td>
-            <td><input name="CookieDomain" tabindex="10160" size="40" value="<?php echo  ENTITY::hsc($CONF['CookieDomain'])?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_COOKIEPATH?></td>
-            <td><input name="CookiePath" tabindex="10170" size="40" value="<?php echo  ENTITY::hsc($CONF['CookiePath'])?>" /></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_COOKIESECURE?></td>
-            <td><?php $this->input_yesno('CookieSecure',$CONF['CookieSecure'],10180); ?></td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_COOKIELIFE?></td>
-            <td><?php $this->input_yesno('SessionCookie',$CONF['SessionCookie'],10190,
-                              1,0,_SETTINGS_COOKIESESSION,_SETTINGS_COOKIEMONTH); ?>
-            </td>
-        </tr><tr>
-            <td><?php echo _SETTINGS_LASTVISIT?></td>
-            <td><?php $this->input_yesno('LastVisit',$CONF['LastVisit'],10200); ?></td>
 
+               </tr><tr>
+                       <th colspan="2"><?php echo _SETTINGS_COOKIES_TITLE?> <?php help('cookies'); ?></th>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_COOKIEPREFIX?></td>
+                       <td><input name="CookiePrefix" tabindex="10159" size="40" value="<?php echo  ENTITY::hsc($CONF['CookiePrefix'])?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_COOKIEDOMAIN?></td>
+                       <td><input name="CookieDomain" tabindex="10160" size="40" value="<?php echo  ENTITY::hsc($CONF['CookieDomain'])?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_COOKIEPATH?></td>
+                       <td><input name="CookiePath" tabindex="10170" size="40" value="<?php echo  ENTITY::hsc($CONF['CookiePath'])?>" /></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_COOKIESECURE?></td>
+                       <td><?php $this->input_yesno('CookieSecure',$CONF['CookieSecure'],10180); ?></td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_COOKIELIFE?></td>
+                       <td><?php $this->input_yesno('SessionCookie',$CONF['SessionCookie'],10190,
+                                                         1,0,_SETTINGS_COOKIESESSION,_SETTINGS_COOKIEMONTH); ?>
+                       </td>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_LASTVISIT?></td>
+                       <td><?php $this->input_yesno('LastVisit',$CONF['LastVisit'],10200); ?></td>
 
 
-        </tr><tr>
-            <th colspan="2"><?php echo _SETTINGS_UPDATE?></th>
-        </tr><tr>
-            <td><?php echo _SETTINGS_UPDATE?></td>
-            <td><input type="submit" tabindex="10210" value="<?php echo _SETTINGS_UPDATE_BTN?>" onclick="return checkSubmit();" /></td>
-        </tr></table>
 
-        </div>
-        </form>
+               </tr><tr>
+                       <th colspan="2"><?php echo _SETTINGS_UPDATE?></th>
+               </tr><tr>
+                       <td><?php echo _SETTINGS_UPDATE?></td>
+                       <td><input type="submit" tabindex="10210" value="<?php echo _SETTINGS_UPDATE_BTN?>" onclick="return checkSubmit();" /></td>
+               </tr></table>
 
-        <?php
-            echo '<h2>',_PLUGINS_EXTRA,'</h2>';
+               </div>
+               </form>
 
-            $manager->notify(
-                'GeneralSettingsFormExtras',
-                array()
-            );
+               <?php
+                       echo '<h2>',_PLUGINS_EXTRA,'</h2>';
 
-        $this->pagefoot();
-    }
+                       $manager->notify(
+                               'GeneralSettingsFormExtras',
+                               array()
+                       );
 
+               $this->pagefoot();
+       }
+       
        /**
         * ADMIN::action_settingsupdate()
         * Update $CONFIG and redirect
@@ -6194,131 +6215,149 @@ selector();
         $this->pagefoot();
     }
 
-    /**
-     * @todo document this
-     */
-    function action_pluginadd() {
-        global $member, $manager, $DIR_PLUGINS;
-
-        // check if allowed
-        $member->isAdmin() or $this->disallow();
-
-        $name = postVar('filename');
-
-        if ($manager->pluginInstalled($name))
-            $this->error(_ERROR_DUPPLUGIN);
-        if (!checkPlugin($name))
-            $this->error(_ERROR_PLUGFILEERROR . ' (' . ENTITY::hsc($name) . ')');
-
-        // get number of currently installed plugins
-        $res = sql_query('SELECT * FROM '.sql_table('plugin'));
-        $numCurrent = sql_num_rows($res);
-
-        // plugin will be added as last one in the list
-        $newOrder = $numCurrent + 1;
-
-        $manager->notify(
-            'PreAddPlugin',
-            array(
-                'file' => &$name
-            )
-        );
-
-        // do this before calling getPlugin (in case the plugin id is used there)
-        $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.$newOrder.',"'.sql_real_escape_string($name).'")';
-        sql_query($query);
-        $iPid = sql_insert_id();
-
-        $manager->clearCachedInfo('installedPlugins');
-
-        // Load the plugin for condition checking and instalation
-        $plugin =& $manager->getPlugin($name);
-
-        // check if it got loaded (could have failed)
-        if (!$plugin)
-        {
-            sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));
-            $manager->clearCachedInfo('installedPlugins');
-            $this->error(_ERROR_PLUGIN_LOAD);
-        }
-
-        // check if plugin needs a newer Nucleus version
-        if (getNucleusVersion() < $plugin->getMinNucleusVersion())
-        {
-            // uninstall plugin again...
-            $this->deleteOnePlugin($plugin->getID());
-
-            // ...and show error
-            $this->error(_ERROR_NUCLEUSVERSIONREQ . ENTITY::hsc($plugin->getMinNucleusVersion()));
-        }
-
-        // check if plugin needs a newer Nucleus version
-        if ((getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()))
-        {
-            // uninstall plugin again...
-            $this->deleteOnePlugin($plugin->getID());
-
-            // ...and show error
-            $this->error(_ERROR_NUCLEUSVERSIONREQ . ENTITY::hsc( $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel() ) );
-        }
-
-        $pluginList = $plugin->getPluginDep();
-        foreach ($pluginList as $pluginName)
-        {
-
-            $res = sql_query('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile="' . $pluginName . '"');
-            if (sql_num_rows($res) == 0)
-            {
-                // uninstall plugin again...
-                $this->deleteOnePlugin($plugin->getID());
-
-                $this->error(sprintf(_ERROR_INSREQPLUGIN, ENTITY::hsc($pluginName)));
-            }
-        }
-
-        // call the install method of the plugin
-        $plugin->install();
-
-        $manager->notify(
-            'PostAddPlugin',
-            array(
-                'plugin' => &$plugin
-            )
-        );
-
-        // update all events
-        $this->action_pluginupdate();
-    }
-
-    /**
-     * @todo document this
-     */
-    function action_pluginupdate() {
-        global $member, $manager, $CONF;
-
-        // check if allowed
-        $member->isAdmin() or $this->disallow();
-
-        // delete everything from plugin_events
-        sql_query('DELETE FROM '.sql_table('plugin_event'));
-
-        // loop over all installed plugins
-        $res = sql_query('SELECT pid, pfile FROM '.sql_table('plugin'));
-        while($o = sql_fetch_object($res)) {
-            $pid = $o->pid;
-            $plug =& $manager->getPlugin($o->pfile);
-            if ($plug)
-            {
-                $eventList = $plug->getEventList();
-                foreach ($eventList as $eventName)
-                    sql_query('INSERT INTO '.sql_table('plugin_event').' (pid, event) VALUES ('.$pid.', \''.sql_real_escape_string($eventName).'\')');
-            }
-        }
-
-        redirect($CONF['AdminURL'] . '?action=pluginlist');
-//             $this->action_pluginlist();
-    }
-
+       /**
+        * ADMIN::action_pluginadd()
+        * 
+        * @param       Void
+        * @return      Void
+        * 
+        */
+       function action_pluginadd()
+       {
+               global $member, $manager, $DIR_PLUGINS;
+               
+               // check if allowed
+               $member->isAdmin() or $this->disallow();
+               
+               $name = postVar('filename');
+               
+               if ( $manager->pluginInstalled($name) )
+               {
+                       $this->error(_ERROR_DUPPLUGIN);
+               }
+               
+               if ( !checkPlugin($name) )
+               {
+                       $this->error(_ERROR_PLUGFILEERROR . ' (' . ENTITY::hsc($name) . ')');
+               }
+               
+               // get number of currently installed plugins
+               $res = sql_query('SELECT * FROM '.sql_table('plugin'));
+               $numCurrent = sql_num_rows($res);
+               
+               // plugin will be added as last one in the list
+               $newOrder = $numCurrent + 1;
+               
+               $manager->notify(
+                       'PreAddPlugin',
+                       array(
+                               'file' => &$name
+                       )
+               );
+               
+               // do this before calling getPlugin (in case the plugin id is used there)
+               $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.$newOrder.',"'.sql_real_escape_string($name).'")';
+               sql_query($query);
+               $iPid = sql_insert_id();
+               
+               $manager->clearCachedInfo('installedPlugins');
+               
+               // Load the plugin for condition checking and instalation
+               $plugin =& $manager->getPlugin($name);
+               
+               // check if it got loaded (could have failed)
+               if ( !$plugin )
+               {
+                       sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));
+                       $manager->clearCachedInfo('installedPlugins');
+                       $this->error(_ERROR_PLUGIN_LOAD);
+               }
+               
+               // check if plugin needs a newer Nucleus version
+               if ( getNucleusVersion() < $plugin->getMinNucleusVersion() )
+               {
+                       // uninstall plugin again...
+                       $this->deleteOnePlugin($plugin->getID());
+                       
+                       // ...and show error
+                       $this->error(_ERROR_NUCLEUSVERSIONREQ . ENTITY::hsc($plugin->getMinNucleusVersion()));
+               }
+               
+               // check if plugin needs a newer Nucleus version
+               if ( (getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()) )
+               {
+                       // uninstall plugin again...
+                       $this->deleteOnePlugin($plugin->getID());
+                       
+                       // ...and show error
+                       $this->error(_ERROR_NUCLEUSVERSIONREQ . ENTITY::hsc( $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel() ) );
+               }
+               
+               $pluginList = $plugin->getPluginDep();
+               foreach ( $pluginList as $pluginName )
+               {
+                       $res = sql_query('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile="' . $pluginName . '"');
+                       if (sql_num_rows($res) == 0)
+                       {
+                               // uninstall plugin again...
+                               $this->deleteOnePlugin($plugin->getID());
+                               $this->error(sprintf(_ERROR_INSREQPLUGIN, ENTITY::hsc($pluginName)));
+                       }
+               }
+               
+               // call the install method of the plugin
+               $plugin->install();
+               
+               $manager->notify(
+                       'PostAddPlugin',
+                       array(
+                               'plugin' => &$plugin
+                       )
+               );
+               
+               // update all events
+               $this->action_pluginupdate();
+               return;
+       }
+       
+       /**
+        * ADMIN:action_pluginupdate():
+        * 
+        * @param       Void
+        * @return      Void
+        * 
+        */
+       function action_pluginupdate()
+       {
+               global $member, $manager, $CONF;
+               
+               // check if allowed
+               $member->isAdmin() or $this->disallow();
+               
+               // delete everything from plugin_events
+               sql_query('DELETE FROM '.sql_table('plugin_event'));
+               
+               // loop over all installed plugins
+               $res = sql_query('SELECT pid, pfile FROM '.sql_table('plugin'));
+               while ( $o = sql_fetch_object($res) )
+               {
+                       $pid = $o->pid;
+                       $plug =& $manager->getPlugin($o->pfile);
+                       if ( $plug )
+                       {
+                               $eventList = $plug->getEventList();
+                               foreach ( $eventList as $eventName )
+                               {
+                                       $query = "INSERT INTO %s (pid, event) VALUES (%d, '%s')";
+                                       $query = sprintf($query, sql_table('plugin_event'), (integer) $pid, sql_real_escape_string($eventName));
+                                       sql_query($query);
+                               }
+                       }
+               }
+               redirect($CONF['AdminURL'] . '?action=pluginlist');
+               return;
+       }
+       
     /**
      * @todo document this
      */
index 671b80f..01d3ec5 100644 (file)
@@ -39,13 +39,21 @@ class BAN {
        }
 
        /**
-         * Adds a new ban to the banlist. Returns 1 on success, 0 on error
-         */
-       function addBan($blogid, $iprange, $reason) {
+        * BAN::addBan()
+        * Adds a new ban to the banlist. Returns 1 on success, 0 on error
+        * 
+        * @param       Integer $blogid ID for weblog
+        * @param       String  $iprange        IP range
+        * @param       String  $reason reason for banning
+        * @return      Boolean
+        * 
+        */
+       function addBan($blogid, $iprange, $reason)
+       {
                global $manager;
-
+               
                $blogid = intval($blogid);
-
+               
                $manager->notify(
                        'PreAddBan',
                        array(
@@ -54,11 +62,11 @@ class BAN {
                                'reason' => &$reason
                        )
                );
-
-               $query = 'INSERT INTO '.sql_table('ban')." (blogid, iprange, reason) VALUES "
-                          . "($blogid,'".sql_real_escape_string($iprange)."','".sql_real_escape_string($reason)."')";
+               
+               $query = "INSERT INTO %s (blogid, iprange, reason) VALUES (%d, '%s', '%s')";
+               $query = sprintf($query, sql_table('ban'), $blogid, sql_real_escape_string($iprange), sql_real_escape_string($reason));
                $res = sql_query($query);
-
+               
                $manager->notify(
                        'PostAddBan',
                        array(
@@ -67,10 +75,9 @@ class BAN {
                                'reason' => $reason
                        )
                );
-
                return $res ? 1 : 0;
        }
-
+       
        /**
          * Removes a ban from the banlist (correct iprange is needed as argument)
          * Returns 1 on success, 0 on error
index ef1b2f0..81991bf 100644 (file)
@@ -248,55 +248,82 @@ class BLOG {
 
 
        /**
-         * Adds an item to this blog
-         */
-       function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft, $posted='1') {
+        * BLOG::addItem()
+        * Adds an item to this blog
+        * 
+        * @param       Integer $catid  ID for category
+        * @param       String  $title  ID for 
+        * @param       String  $body   text for body
+        * @param       String  $more   text for more
+        * @param       Integer $blogid ID for blog
+        * @param       Integer $authorid       ID for author
+        * @param       Timestamp       $timestamp      UNIX timestamp for post
+        * @param       Boolean $closed opened or closed
+        * @param       Boolean $draft  draft or not
+        * @param       Boolean $posted posted or not
+        * @return
+        */
+       function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft, $posted='1')
+       {
                global $manager;
-
+               
                $blogid         = intval($blogid);
                $authorid       = intval($authorid);
                $title          = $title;
                $body           = $body;
                $more           = $more;
                $catid          = intval($catid);
-
+               
                // convert newlines to <br />
-               if ($this->convertBreaks()) {
+               if ( $this->convertBreaks() )
+               {
                        $body = addBreaks($body);
                        $more = addBreaks($more);
                }
 
-               if ($closed != '1') $closed = '0';
-               if ($draft != '0') $draft = '1';
-
-               if (!$this->isValidCategory($catid))
+               if ( $closed != '1' )
+               {
+                       $closed = '0';
+               }
+               if ( $draft != '0' )
+               {
+                       $draft = '1';
+               }
+               
+               if ( !$this->isValidCategory($catid) )
+               {
                        $catid = $this->getDefaultCategory();
-
-               if ($timestamp > $this->getCorrectTime())
+               }
+               
+               if ( $timestamp > $this->getCorrectTime() )
+               {
                        $isFuture = 1;
-
+               }
+               
                $timestamp = date('Y-m-d H:i:s',$timestamp);
-
+               
                $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid));
-
+               
                $ititle = sql_real_escape_string($title);
                $ibody = sql_real_escape_string($body);
                $imore = sql_real_escape_string($more);
-
-               $query = 'INSERT INTO '.sql_table('item').' (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT, IPOSTED) '
-                          . "VALUES ('$ititle', '$ibody', '$imore', $blogid, $authorid, '$timestamp', $closed, $draft, $catid, $posted)";
+               
+               $query = "INSERT INTO %s (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT, IPOSTED) VALUES ('%s', '%s', '%s', %d, %d, '%s', %s, %s, %s, %s)";
+               $query = sprintf($query, sql_table('item'), $ititle, $ibody, $imore, $blogid, $authorid, $timestamp, $closed, $draft, $catid, $posted);
                sql_query($query);
                $itemid = sql_insert_id();
-
+               
                $manager->notify('PostAddItem',array('itemid' => $itemid));
-
-               if (!$draft)
+               
+               if ( !$draft )
+               {
                        $this->updateUpdateFile();
-
+               }
                // send notification mail
-               if (!$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem())
+               if ( !$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem() )
+               {
                        $this->sendNewItemNotification($itemid, $title, $body);
-
+               }
                return $itemid;
        }
        
@@ -346,38 +373,35 @@ class BLOG {
        }
        
        /**
-         * Creates a new category for this blog
-         *
-         * @param $catName
-         *             name of the new category. When empty, a name is generated automatically
-         *             (starting with newcat)
-         * @param $catDescription
-         *             description of the new category. Defaults to 'New Category'
-         *
-         * @returns
-         *             the new category-id in case of success.
-         *             0 on failure
-         */
-       function createNewCategory($catName = '', $catDescription = _CREATED_NEW_CATEGORY_DESC) {
+        * BLOG::createNewCategory()
+        * Creates a new category for this blog
+        *
+        * @param String        $catName        name of the new category. When empty, a name is generated automatically (starting with newcat)
+        * @param String        $catDescription description of the new category. Defaults to 'New Category'
+        * @returns     Integer the new category-id in case of success. 0 on failure
+        */
+       function createNewCategory($catName = '', $catDescription = _CREATED_NEW_CATEGORY_DESC)
+       {
                global $member, $manager;
-
-               if ($member->blogAdminRights($this->getID())) {
+               
+               if ( $member->blogAdminRights($this->getID()) )
+               {
                        // generate
-                       if ($catName == '')
+                       if ( $catName == '' )
                        {
                                $catName = _CREATED_NEW_CATEGORY_NAME;
                                $i = 1;
-
+                               
                                $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->getID());
-                               while (sql_num_rows($res) > 0)
+                               while ( sql_num_rows($res) > 0 )
                                {
                                        $i++;
                                        $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->getID());
                                }
-
+                               
                                $catName = $catName . $i;
                        }
-
+                       
                        $manager->notify(
                                'PreAddCategory',
                                array(
@@ -386,11 +410,12 @@ class BLOG {
                                        'description' => $catDescription
                                )
                        );
-
-                       $query = 'INSERT INTO '.sql_table('category').' (cblog, cname, cdesc) VALUES (' . $this->getID() . ", '" . sql_real_escape_string($catName) . "', '" . sql_real_escape_string($catDescription) . "')";
+                       
+                       $query = "INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, '%s', '%s')";
+                       $query = sprintf($query, sql_table('category'), (integer) $this->getID(). sql_real_escape_string($catName), sql_real_escape_string($catDescription));
                        sql_query($query);
                        $catid = sql_insert_id();
-
+                       
                        $manager->notify(
                                'PostAddCategory',
                                array(
@@ -400,15 +425,12 @@ class BLOG {
                                        'catid' => $catid
                                )
                        );
-
+                       
                        return $catid;
-               } else {
-                       return 0;
                }
-
+               return 0;
        }
-
-
+       
        /**
         * Searches all months of this blog for the given query
         *
@@ -1235,21 +1257,29 @@ class BLOG {
        }
 
        /**
-         * Tries to add a member to the team. 
-         * Returns false if the member was already on the team
-         */
-       function addTeamMember($memberid, $admin) {
+        * BLOG::addTeamMember()
+        * Tries to add a member to the team. 
+        * Returns false if the member was already on the team
+        * 
+        * @param       Integer $memberid       id for member
+        * @param       Boolean $admin  super-admin or not
+        * @return      Boolean Success/Fail
+        */
+       function addTeamMember($memberid, $admin)
+       {
                global $manager;
-
+               
                $memberid = intval($memberid);
                $admin = intval($admin);
-
+               
                // check if member is already a member
                $tmem = MEMBER::createFromID($memberid);
-
-               if ($tmem->isTeamMember($this->getID()))
+               
+               if ( $tmem->isTeamMember($this->getID()) )
+               {
                        return 0;
-
+               }
+               
                $manager->notify(
                        'PreAddTeamMember',
                        array(
@@ -1258,10 +1288,10 @@ class BLOG {
                                'admin' => &$admin
                        )
                );
-
+               
                // add to team
-               $query = 'INSERT INTO '.sql_table('team').' (TMEMBER, TBLOG, TADMIN) '
-                          . 'VALUES (' . $memberid .', '.$this->getID().', "'.$admin.'")';
+               $query = "INSERT INTO %s (TMEMBER, TBLOG, TADMIN) ' . 'VALUES (%d, %d, %d)";
+               $query = sprintf($query, sql_table('team'), $memberid, $this->getID(), $admin);
                sql_query($query);
 
                $manager->notify(
@@ -1271,12 +1301,11 @@ class BLOG {
                                'member' => &$tmem,
                                'admin' => $admin
                        )
-
                );
-
+               
                $logMsg = sprintf(_TEAM_ADD_NEWTEAMMEMBER, $tmem->getDisplayName(), $memberid, $this->getName());
                ACTIONLOG::add(INFO, $logMsg);
-
+               
                return 1;
        }
 
index e2ef5e2..652b726 100644 (file)
@@ -181,9 +181,17 @@ class SKIN {
        }
        
        /**
+        * SKIN::createNew()
         * Creates a new skin, with the given characteristics.
         *
         * @static
+        * @param       String  $name   value for nucleus_skin.sdname
+        * @param       String  $desc   value for nucleus_skin.sddesc
+        * @param       String  $type   value for nucleus_skin.sdtype
+        * @param       String  $includeMode    value for nucleus_skin.sdinclude
+        * @param       String  $includePrefix  value for nucleus_skin.sdincpref
+        * @return      Integer ID for just inserted record
+        * 
         */
        function createNew($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '')
        {
@@ -200,7 +208,9 @@ class SKIN {
                        )
                );
                
-               sql_query('INSERT INTO ' . sql_table('skin_desc') . " (sdname, sddesc, sdtype, sdincmode, sdincpref) VALUES ('" . sql_real_escape_string($name) . "','" . sql_real_escape_string($desc) . "','" . sql_real_escape_string($type) . "','" . sql_real_escape_string($includeMode) . "','" . sql_real_escape_string($includePrefix) . "')");
+               $query = "INSERT INTO %s (sdname, sddesc, sdtype, sdincmode, sdincpref) VALUES ('%s', '%s', '%s', '%s', '%s')";
+               $query = sprintf($query, sql_table('skin_desc'), sql_real_escape_string($name), sql_real_escape_string($desc), sql_real_escape_string($type), sql_real_escape_string($includeMode), sql_real_escape_string($includePrefix));
+               sql_query($query);
                $newid = sql_insert_id();
                
                $manager->notify(
@@ -287,20 +297,24 @@ class SKIN {
        }
 
        /**
+        * SKIN::update()
         * Updates the contents for one part of the skin in the database
         * 
         * @param $type type of the skin part (e.g. index, item, search ...) 
         * @param $content new content for this skin part
+        * @return      Void
+        * 
         */
-
        function update($type, $content)
        {
                global $manager;
                
                $skinid = $this->id;
                
-               $query = 'SELECT sdesc FROM ' . sql_table('skin') . " WHERE stype='" . sql_real_escape_string($type) . "' and sdesc=" . intval($skinid);
+               $query = "SELECT sdesc FROM %s WHERE stype='%s' and sdesc=%d";
+               $query = sprintf($query, sql_table('skin'), sql_real_escape_string($type), (integer) $skinid);
                $res = sql_query($query);
+               
                $skintypeexists = sql_fetch_object($res);
                $skintypevalue = ($content == true);
                
@@ -341,12 +355,16 @@ class SKIN {
                }
                
                // delete old thingie
-               sql_query('DELETE FROM ' . sql_table('skin') . " WHERE stype='" . sql_real_escape_string($type) . "' and sdesc=" . intval($skinid));
+               $query = "DELETE FROM %s WHERE stype='%s' and sdesc=%d";
+               $query = sprintf($query, sql_table('skin'), sql_real_escape_string($type), (integer) $skinid);
+               sql_query($query);
                
                // write new thingie
                if ( $content )
                {
-                       sql_query('INSERT INTO ' . sql_table('skin') . " SET scontent='" . sql_real_escape_string($content) . "', stype='" . sql_real_escape_string($type) . "', sdesc=" . intval($skinid));
+                       $query = "INSERT INTO %s (scontent, stype, sdesc) VALUE ('%s', '%s', %d)";
+                       $query = sprintf($query, sql_table('skin'), sql_real_escape_string($content), sql_real_escape_string($type), (integer) $skinid);
+                       sql_query($query);
                }
                
                if( $skintypevalue && $skintypeexists )
@@ -384,6 +402,7 @@ class SKIN {
                                )
                        );
                }
+               return;
        }
        
        /**
index 7c84631..3093549 100644 (file)
@@ -56,18 +56,28 @@ class TEMPLATE {
        }
 
        /**
+        * TEMPLATE::update()
         * Updates the contents of one part of the template
+        * 
+        * @param       String  $type   value for nucleus_template.tpartname
+        * @param       String  $content        value for nucleus_template.tcontent
+        * @return      Void
         */
-       function update($type, $content) {
-               $id = $this->getID();
-
+       function update($type, $content)
+       {
                // delete old thingie
-               sql_query('DELETE FROM '.sql_table('template')." WHERE tpartname='". sql_real_escape_string($type) ."' and tdesc=" . intval($id));
-
+               $query = "DELETE FROM %s WHERE tpartname='%s' and tdesc=%d";
+               $query = sprintf($query, sql_table('template'), sql_real_escape_string($type), (integer) $this->getID());
+               sql_query($query);
+               
                // write new thingie
-               if ($content) {
-                       sql_query('INSERT INTO '.sql_table('template')." SET tcontent='" . sql_real_escape_string($content) . "', tpartname='" . sql_real_escape_string($type) . "', tdesc=" . intval($id));
+               if ( $content )
+               {
+                       $query = "INSERT %s (tcontent, tpartname, tdesc) VALUE ('%s', '%s', %d)";
+                       $query = sprintf($query, sql_table('template'), sql_real_escape_string($content), sql_real_escape_string($type), (integer) $this->getID());
+                       sql_query($query);
                }
+               return;
        }