Example #1
0
 function fbMovePosts($catid, $isMod, $return)
 {
     $app =& JFactory::getApplication();
     $backUrl = $app->getUserState("com_kunena.ActionBulk");
     $kunena_db =& JFactory::getDBO();
     $kunena_my =& JFactory::getUser();
     // $isMod if user is moderator in the current category
     if (!$isMod) {
         // Test also if user is a moderator in some other category
         $kunena_db->setQuery("SELECT userid FROM #__fb_moderation WHERE userid='{$kunena_my->id}'");
         $isMod = $kunena_db->loadResult();
         check_dberror("Unable to load moderation info.");
     }
     $isAdmin = CKunenaTools::isModOrAdmin();
     //isMod will stay until better group management comes in
     if (!$isAdmin && !$isMod) {
         $app->redirect($return, _POST_NOT_MODERATOR);
     }
     $catid = (int) $catid;
     if ($catid > 0) {
         $items = fbGetArrayInts("fbDelete");
         // start iterating here
         foreach ($items as $id => $value) {
             $id = (int) $id;
             $kunena_db->setQuery("SELECT subject, catid, time AS timestamp FROM #__fb_messages WHERE id='{$id}'");
             $oldRecord = $kunena_db->loadObjectList();
             check_dberror("Unable to load message detail.");
             $newCatObj = new jbCategory($kunena_db, $oldRecord[0]->catid);
             if (fb_has_moderator_permission($kunena_db, $newCatObj, $kunena_my->id, $isAdmin)) {
                 $newSubject = _MOVED_TOPIC . " " . $oldRecord[0]->subject;
                 $kunena_db->setQuery("SELECT MAX(time) AS timestamp FROM #__fb_messages WHERE thread='{$id}'");
                 $lastTimestamp = $kunena_db->loadResult();
                 check_dberror("Unable to load messages max(time).");
                 if ($lastTimestamp == "") {
                     $lastTimestamp = $oldRecord[0]->timestamp;
                 }
                 //perform the actual move
                 $kunena_db->setQuery("UPDATE #__fb_messages SET `catid`='{$catid}' WHERE `id`='{$id}' OR `thread`='{$id}'");
                 $kunena_db->query();
                 check_dberror("Unable to move thread.");
                 $err = _POST_SUCCESS_MOVE;
             } else {
                 $err = _POST_NOT_MODERATOR;
             }
         }
         //end foreach
     } else {
         $err = _POST_NO_DEST_CATEGORY;
     }
     CKunenaTools::reCountBoards();
     $app->redirect($return, $err);
 }
Example #2
0
    function editUserProfile($user, $subslist, $selectRank, $selectPref, $selectMod, $selectOrder, $uid, $modCats)
    {
        $fbConfig =& CKunenaConfig::getInstance();
        $kunena_db =& JFactory::getDBO();
        //fill the variables needed later
        $signature = $user->signature;
        $username = $user->name;
        $avatar = $user->avatar;
        $ordering = $user->ordering;
        //that's what we got now; later the 'future_use' columns can be used..
        $csubslist = count($subslist);
        //        include_once ('components/com_kunena/bb_adm.js');
        ?>

        <form action = "index2.php?option=<?php 
        echo $option;
        ?>
" method = "POST" name = "adminForm">
            <table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminheading">
                <tr>
                    <th colspan = "3" class = "user">
<?php 
        echo _KUNENA_PROFFOR;
        ?>
 <?php 
        echo $username;
        ?>
                    </th>
                </tr>
            </table>

            <table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminlist">
                <tr>
                    <th colspan = "3" class = "title">
<?php 
        echo _KUNENA_GENPROF;
        ?>

                </tr>

                <tr>
                    <td width = "150" class = "contentpane"><?php 
        echo _KUNENA_PREFOR;
        ?>
                    </td>

                    <td align = "left" valign = "top" class = "contentpane">
<?php 
        echo $selectOrder;
        ?>
                    </td>

                    <td>&nbsp;

                    </td>
                </tr>

                         <tr>
                    <td width = "150" class = "contentpane"><?php 
        echo _KUNENA_RANKS;
        ?>
                    </td>

                    <td align = "left" valign = "top" class = "contentpane">
<?php 
        echo $selectRank;
        ?>
                    </td>

                    <td>&nbsp;

                    </td>
                </tr>



                            <td width = "150" valign = "top" class = "contentpane">
<?php 
        echo _GEN_SIGNATURE;
        ?>
:
<?php 
        /*
        // FIXME: bbcode broken
        
                <br/> <?php echo $fbConfig->maxsig; ?>
        
                <input readonly type = text name = rem size = 3 maxlength = 3 value = "" class = "inputbox"> <?php echo _CHARS; ?><br/>
        <?php echo _HTML_YES; ?>
        */
        ?>
                            </td>

                            <td align = "left" valign = "top" class = "contentpane">
                                <textarea rows = "6"
                                    class = "inputbox"
                                    onMouseOver = "textCounter(this.form.message,this.form.rem,<?php 
        echo $fbConfig->maxsig;
        ?>
);"
                                    onClick = "textCounter(this.form.message,this.form.rem,<?php 
        echo $fbConfig->maxsig;
        ?>
);"
                                    onKeyDown = "textCounter(this.form.message,this.form.rem,<?php 
        echo $fbConfig->maxsig;
        ?>
);"
                                    onKeyUp = "textCounter(this.form.message,this.form.rem,<?php 
        echo $fbConfig->maxsig;
        ?>
);" cols = "50" type = "text" name = "message"><?php 
        echo html_entity_decode_utf8(stripslashes($signature));
        ?>
</textarea>

<?php 
        /*
        // FIXME: bbcode broken
                                        <br/>
        
                                        <input type = "button" class = "button" accesskey = "b" name = "addbbcode0" value = " B " style = "font-weight:bold; width: 30px" onClick = "bbstyle(0)" onMouseOver = "helpline('b')"/>
        
                                        <input type = "button" class = "button" accesskey = "i" name = "addbbcode2" value = " i " style = "font-style:italic; width: 30px" onClick = "bbstyle(2)" onMouseOver = "helpline('i')"/>
        
                                        <input type = "button" class = "button" accesskey = "u" name = "addbbcode4" value = " u " style = "text-decoration: underline; width: 30px" onClick = "bbstyle(4)" onMouseOver = "helpline('u')"/>
        
                                        <input type = "button" class = "button" accesskey = "p" name = "addbbcode14" value = "Img" style = "width: 40px" onClick = "bbstyle(14)" onMouseOver = "helpline('p')"/>
        
                                        <input type = "button" class = "button" accesskey = "w" name = "addbbcode16" value = "URL" style = "text-decoration: underline; width: 40px" onClick = "bbstyle(16)" onMouseOver = "helpline('w')"/>
        
                                        <br/><?php echo _KUNENA_COLOR; ?>:
        
                <select name = "addbbcode20" onChange = "bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver = "helpline('s')">
                    <option style = "color:black;  background-color: #FAFAFA" value = ""><?php echo _COLOUR_DEFAULT; ?></option>
        
                    <option style = "color:red;    background-color: #FAFAFA" value = "#FF0000"><?php echo _COLOUR_RED; ?></option>
        
                    <option style = "color:blue;   background-color: #FAFAFA" value = "#0000FF"><?php echo _COLOUR_BLUE; ?></option>
        
                    <option style = "color:green;  background-color: #FAFAFA" value = "#008000"><?php echo _COLOUR_GREEN; ?></option>
        
                    <option style = "color:yellow; background-color: #FAFAFA" value = "#FFFF00"><?php echo _COLOUR_YELLOW; ?></option>
        
                    <option style = "color:orange; background-color: #FAFAFA" value = "#FF6600"><?php echo _COLOUR_ORANGE; ?></option>
                </select>
        <?php echo _SMILE_SIZE; ?>:
        
                <select name = "addbbcode22" onChange = "bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onMouseOver = "helpline('f')">
                    <option value = "1"><?php echo _SIZE_VSMALL; ?></option>
        
        
                    <option value = "2"><?php echo _SIZE_SMALL; ?></option>
        
                    <option value = "3" selected><?php echo _SIZE_NORMAL; ?></option>
        
                    <option value = "4"><?php echo _SIZE_BIG; ?></option>
        
                    <option value = "5"><?php echo _SIZE_VBIG; ?></option>
                </select>
        
                <a href = "javascript: bbstyle(-1)"onMouseOver = "helpline('a')"><small><?php echo _BBCODE_CLOSA; ?></small></a>
        
                <br/>
        
                <input type = "text" name = "helpbox" size = "45" maxlength = "100" style = "width:400px; font-size:8px" class = "options" value = "<?php echo _BBCODE_HINT;?>"/>
        */
        ?>
                            </td>

                            <?php 
        if ($fbConfig->allowavatar) {
            ?>

                                <td class = "contentpane" align = "center">
<?php 
            echo _KUNENA_UAVATAR;
            ?>
<br/>

<?php 
            if ($avatar != '') {
                echo '<img src="' . KUNENA_LIVEUPLOADEDPATH . '/avatars/' . $avatar . '" ><br />';
                echo '<input type="hidden" value="' . $avatar . '" name="avatar">';
            } else {
                echo "<em>" . _KUNENA_NS . "</em><br />";
                echo '<input type="hidden" value="$avatar" name="avatar">';
            }
            ?>
                                </td>

                            <?php 
        } else {
            echo "<td>&nbsp;</td>";
            echo '<input type="hidden" value="" name="avatar">';
        }
        ?>
                        </tr>

                        <tr>
                            <td colspan = "2" class = "contentpane">
                                <input type = "checkbox" value = "1" name = "deleteSig"><i><?php 
        echo _KUNENA_DELSIG;
        ?>
</i>
                            </td>

                            <?php 
        if ($fbConfig->allowavatar) {
            ?>

                                <td class = "contentpane">
                                    <input type = "checkbox" value = "1" name = "deleteAvatar"><i><?php 
            echo _KUNENA_DELAV;
            ?>
</i>
                                </td>

                            <?php 
        } else {
            echo "<td>&nbsp;</td>";
        }
        ?>
                        </tr>

                        <tr cellspacing = "3" colspan = "2">
                            &nbsp;

                            </td>
                        </tr>
            </table>

        <table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminform">
            <tr>
                <th colspan = "2" class = "title">
<?php 
        echo _KUNENA_MOD_NEW;
        ?>

            </td>
            </tr>
                        </tr>

                        <tr>


    <td width = "150" class = "contentpane">
    <?php 
        echo _KUNENA_ISMOD;
        ?>

                    <?php 
        //admins are always moderators
        if (CKunenaTools::isModOrAdmin($uid)) {
            echo _KUNENA_ISADM;
            ?>
 <input type = "hidden" name = "moderator" value = "1">
                    <?php 
        } else {
            echo $selectMod;
        }
        ?>
                        </td>
                        <td>
<?php 
        echo $modCats;
        ?>
                        </td>
                        </tr>

            </table>
            <input type = "hidden" name = "uid" value = "<?php 
        echo $uid;
        ?>
">

            <input type = "hidden" name = "task" value = ""/>

            <input type = "hidden" name = "option" value = "com_kunena"/>
        </form>

        <table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminform">
            <tr>
                <th colspan = "2" class = "title">
<?php 
        echo _KUNENA_SUBFOR;
        ?>
 <?php 
        echo $username;
        ?>

            </td>
            </tr>

            <?php 
        $enum = 1;
        //reset value
        $k = 0;
        //value for alternating rows
        if ($csubslist > 0) {
            foreach ($subslist as $subs) {
                //get all message details for each subscription
                $kunena_db->setQuery("select * from #__fb_messages where id={$subs->thread}");
                $subdet = $kunena_db->loadObjectList();
                check_dberror("Unable to load subscription messages.");
                foreach ($subdet as $sub) {
                    $k = 1 - $k;
                    echo "<tr class=\"row{$k}\">";
                    echo "  <td>{$enum}: " . html_entity_decode_utf8(stripslashes($sub->subject)) . " by " . html_entity_decode_utf8(stripslashes($sub->name));
                    echo "  <td>&nbsp;</td>";
                    echo "</tr>";
                    $enum++;
                }
            }
        } else {
            echo "<tr><td class=\"message\">" . _KUNENA_NOSUBS . "</td></tr>";
        }
        echo "</table>";
    }