Exemplo n.º 1
0
function check_dberror($text = '')
{
    $kunena_db =& JFactory::getDBO();
    if ($kunena_db->_errorNum != 0) {
        trigger_dberror($text);
    }
}
Exemplo n.º 2
0
function check_dberror($text = '', $back = 0)
{
    $kunena_db =& JFactory::getDBO();
    if ($kunena_db->getErrorNum() != 0) {
        trigger_dberror($text, $back + 1);
    }
}
}
$kunena_db->setQuery("TRUNCATE #__fb_favorites");
$kunena_db->query();
$kunena_db->setQuery("ALTER TABLE `#__fb_favorites` DROP INDEX `thread`");
$kunena_db->query();
$kunena_db->setQuery("ALTER TABLE `#__fb_favorites` ADD UNIQUE `thread`(`thread`,`userid`)");
$kunena_db->query() or trigger_dberror("Unable to alter fb_favorites table, please contact Kunena team at www.kunena.com!");
if ($temporary) {
    $kunena_db->setQuery("INSERT INTO #__fb_favorites (thread,userid) SELECT thread, userid FROM #__fb_favorites_temp");
    $kunena_db->query() or trigger_dbwarning("Unable to fix fb_favorites table. All Favorites will be removed.");
    $kunena_db->setQuery("DROP TABLE #__fb_favorites_temp");
    $kunena_db->query() or trigger_dbwarning("Unable to remove temporary table (#__fb_favorites_temp).");
}
$temporary = 1;
$kunena_db->setQuery("CREATE TABLE #__fb_subscriptions_temp SELECT thread, userid, future1 FROM #__fb_subscriptions WHERE userid>0 GROUP BY thread, userid");
if ($kunena_db->query() == FALSE) {
    $temporary = 0;
    trigger_dbwarning("Unable to fix fb_subscriptions table. All Subscriptions will be removed.");
}
$kunena_db->setQuery("TRUNCATE #__fb_subscriptions");
$kunena_db->query();
$kunena_db->setQuery("ALTER TABLE `#__fb_subscriptions` DROP INDEX `thread`");
$kunena_db->query();
$kunena_db->setQuery("ALTER TABLE `#__fb_subscriptions` ADD UNIQUE `thread`(`thread`,`userid`)");
$kunena_db->query() or trigger_dberror("Unable to alter fb_subscriptions table, please contact Kunena team at www.kunena.com!");
if ($temporary) {
    $kunena_db->setQuery("INSERT INTO #__fb_subscriptions (thread,userid,future1) SELECT thread, userid, future1 FROM #__fb_subscriptions_temp");
    $kunena_db->query() or trigger_dbwarning("Unable to fix fb_subscriptions table. All Subscriptions will be removed.");
    $kunena_db->setQuery("DROP TABLE #__fb_subscriptions_temp");
    $kunena_db->query() or trigger_dbwarning("Unable to remove temporary table (#__fb_subscriptions_temp).");
}
Exemplo n.º 4
0
 function store($updateNulls = false)
 {
     if ($ret = parent::store($updateNulls)) {
         // we must reset fbSession (allowed), when forum record was changed
         $this->_db->setQuery("UPDATE #__fb_sessions SET allowed='na'");
         $this->_db->query() or trigger_dberror("Unable to update sessions.");
     }
     return $ret;
 }
Exemplo n.º 5
0
            }
            // delete original file
            unlink($src_file);
            $kunena_db->setQuery("UPDATE #__fb_users SET avatar='{$newFileName}' WHERE userid={$kunena_my->id}");
            $kunena_db->query() or trigger_dberror("Unable to update avatar.");
            $app->redirect(JRoute::_(KUNENA_LIVEURLREL . '&func=myprofile'), _UPLOAD_UPLOADED);
        case 'gallery':
            require_once KUNENA_PATH_LIB . DS . 'kunena.helpers.php';
            $newAvatar = JRequest::getVar('newAvatar', '');
            $newAvatar = CKunenaTools::fbRemoveXSS($newAvatar);
            if ($newAvatar == '') {
                $app->enqueueMessage(_UPLOAD_ERROR_CHOOSE, 'notice');
                $app->redirect(JRoute::_(KUNENA_LIVEURLREL . '&func=myprofile&do=avatar'));
            }
            $kunena_db->setQuery("UPDATE #__fb_users SET avatar='{$kunena_db->getEscaped($newAvatar)}' WHERE userid={$kunena_my->id}");
            $kunena_db->query() or trigger_dberror("Unable to update user avatar.");
            $app->redirect(JRoute::_(KUNENA_LIVEURLREL . '&func=myprofile'), _UPLOAD_UPLOADED);
            break;
    }
    if ($task == 'default') {
        if ($fbConfig->allowavatar) {
            ?>
        <td class = "fb_myprofile_right" valign = "top">
            <!-- B:My Profile Right -->
            <!-- B: My AVATAR -->
            <form action = "<?php 
            echo JRoute::_(KUNENA_LIVEURLREL . '&func=myprofile&do=avatar&action=delete');
            ?>
" method = "post" name = "postform">
    <table class = "fb_blocktable" id = "fb_forumprofile_sub" border = "0" cellspacing = "0" cellpadding = "0" width="100%">
        <thead>
Exemplo n.º 6
0
     $kunena_db->setQuery("UPDATE #__fb_messages SET `catid`='{$catid}' WHERE `id`='{$id}'");
     $kunena_db->query() or trigger_dberror('Unable to move thread.');
     $kunena_db->setQuery("UPDATE #__fb_messages set `catid`='{$catid}' WHERE `thread`='{$id}'");
     $kunena_db->query() or trigger_dberror('Unable to move thread.');
     // insert 'moved topic' notification in old forum if needed
     if ($bool_leaveGhost) {
         $kunena_db->setQuery("INSERT INTO #__fb_messages (`parent`, `subject`, `time`, `catid`, `moved`, `userid`, `name`) VALUES ('0'," . $kunena_db->quote($newSubject) . ",'{$lastTimestamp}','{$oldRecord[0]->catid}','1', '{$kunena_my->id}', '" . $kunena_db->quote(trim(addslashes($my_name))) . "')");
         $kunena_db->query() or trigger_dberror('Unable to insert ghost message.');
         //determine the new location for link composition
         $newId = $kunena_db->insertid();
         $newURL = "catid=" . $catid . "&id=" . $id;
         $kunena_db->setQuery("INSERT INTO #__fb_messages_text (`mesid`, `message`) VALUES ('{$newId}', " . $kunena_db->quote($newURL) . ")");
         $kunena_db->query() or trigger_dberror('Unable to insert ghost message.');
         //and update the thread id on the 'moved' post for the right ordering when viewing the forum..
         $kunena_db->setQuery("UPDATE #__fb_messages SET `thread`='{$newId}' WHERE `id`='{$newId}'");
         $kunena_db->query() or trigger_dberror('Unable to move thread.');
     }
     //move succeeded
     CKunenaTools::reCountBoards();
     echo '<br /><br /><div align="center">' . _POST_SUCCESS_MOVE . "</div><br />";
     echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $id, $fbConfig->messages_per_page, $catid);
 } else {
     if ($do == "merge") {
         if (!$is_Moderator) {
             $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR);
         }
         $catid = (int) $catid;
         $id = (int) $id;
         //get list of available threads in same forum
         $kunena_db->setQuery("SELECT id, subject FROM #__fb_messages WHERE parent='0' AND catid='{$catid}' AND id!='{$id}'");
         //$kunena_db->setQuery("SELECT a.*, b.name AS category" . "\nFROM #__fb_categories AS a" . "\nLEFT JOIN #__fb_categories AS b ON b.id = a.parent" . "\nWHERE a.parent != '0'" . "\nORDER BY parent, ordering");
Exemplo n.º 7
0
                    echo _USER_ERROR_C . "<br /><br />" . _USER_ERROR_D . ": <code>fb001-karma-02NoDO</code><br /><br />";
                }
            }
        } else {
            echo _KARMA_WAIT . '<br /> ' . _KARMA_BACK . ' <a href="' . JRoute::_(KUNENA_LIVEURLREL . '&amp;func=view&amp;catid=' . $catid . '&amp;id=' . $pid) . '">' . _POST_CLICK . '</a>.';
        }
    } else {
        if ($kunena_my->id == $userid) {
            if ($do == "increase") {
                $kunena_db->setQuery('UPDATE #__fb_users SET karma=karma-10, karma_time=' . $time . ' WHERE userid=' . $kunena_my->id . '');
                $kunena_db->query() or trigger_dberror("Unable to update karma.");
                echo _KARMA_SELF_INCREASE . '<br />' . _KARMA_BACK . ' <a href="' . JRoute::_(KUNENA_LIVEURLREL . '&amp;func=view&amp;catid=' . $catid . '&amp;id=' . $pid) . '">' . _POST_CLICK . '</a>.';
            }
            if ($do == "decrease") {
                $kunena_db->setQuery('UPDATE #__fb_users SET karma_time=' . $time . ' WHERE userid=' . $kunena_my->id . '');
                $kunena_db->query() or trigger_dberror("Unable to update karma.");
                echo _KARMA_SELF_DECREASE . '<br /> ' . _KARMA_BACK . ' <a href="' . JRoute::_(KUNENA_LIVEURLREL . '&amp;func=view&amp;catid=' . $catid . '&amp;id=' . $pid) . '">' . _POST_CLICK . '</a>.';
            }
        }
    }
} else {
    //get outa here, you fraud!
    echo _USER_ERROR_A;
    echo _USER_ERROR_B . "<br /><br />";
    echo _USER_ERROR_C . "<br /><br />" . _USER_ERROR_D . ": <code>fb001-karma-01NLO</code><br /><br />";
    //that should scare 'em off enough... ;-)
}
?>
            </center>
        </td>
    </tr>
Exemplo n.º 8
0
                    <br/>

                    <br/>

                    <br/>
                </form>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php 
    }
    // FINISH: EDIT ANN
    // BEGIN: delete ANN
    if ($do == "delete") {
        $query1 = "DELETE FROM #__fb_announcement WHERE id={$id} ";
        $kunena_db->setQuery($query1);
        $kunena_db->query() or trigger_dberror("Unable to delete announcement.");
        $app->redirect(CKunenaLink::GetAnnouncementURL($fbConfig, 'show'), _ANN_DELETED);
    }
    // FINISH: delete ANN
    ?>
<!-- /announcement-->
<?php 
}
Exemplo n.º 9
0
function editRank($option, $id)
{
    $kunena_db =& JFactory::getDBO();
    $kunena_db->setQuery("SELECT * FROM #__fb_ranks WHERE rank_id = '{$id}'");
    $kunena_db->query() or trigger_dberror("Unable to load ranks.");
    $ranks = $kunena_db->loadObjectList();
    check_dberror("Unable to load ranks.");
    $rank_images = collectRanks();
    $path = rankpath();
    $path = $path['live'] . DS;
    $edit_img = $filename_list = '';
    foreach ($ranks as $row) {
        foreach ($rank_images as $img) {
            $image = $path . $img;
            if ($img == $row->rank_image) {
                $selected = ' selected="selected"';
                $edit_img = $path . $img;
            } else {
                $selected = '';
            }
            if (strlen($img) > 255) {
                continue;
            }
            $filename_list .= '<option value="' . kunena_htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>';
        }
    }
    html_Kunena::editRank($option, KUNENA_LANGUAGE, $edit_img, $filename_list, $path, $row);
}
Exemplo n.º 10
0
        $spath = $sname;
    } else {
        $spath = $sname . ' � ' . $spath;
    }
    // next looping
    $catids = $parent_ids;
}
$shome = '<a href="' . JRoute::_(KUNENA_LIVEURLREL) . '">' . _GEN_FORUMLIST . '</a> ';
$pathNames = $shome . ' � ' . $spath . " ";
echo $pathNames;
//Get the category name for breadcrumb
$kunena_db->setQuery("SELECT id, name, locked, review, description, parent FROM #__fb_categories WHERE id='{$catid}'");
$objCatInfo = $kunena_db->loadObject() or trigger_dberror("Unable to read from categories.");
//Get the Category's parent category name for breadcrumb
$kunena_db->setQuery("SELECT name, id FROM #__fb_categories WHERE id='{$objCatInfo->parent}'");
$objCatParentInfo = $kunena_db->loadObject() or trigger_dberror("Unable to read from categories.");
// set page title
$document =& JFactory::getDocument();
$document->setTitle(stripslashes($objCatParentInfo->name) . ' - ' . stripslashes($objCatInfo->name) . ' - ' . stripslashes($fbConfig->board_title));
//check if this forum is locked
$forumLocked = $objCatInfo->locked;
//check if this forum is subject to review
$forumReviewed = $objCatInfo->review;
/*      echo '<a href="'.JRoute::_(KUNENA_LIVEURLREL).'">';
          echo isset($fbIcons['forumlist']) ? '<img src="' . KUNENA_TMPLTURL . '/images/icons/'.$fbIcons['forumlist'].'" border="0" alt="'._GEN_FORUMLIST.'" > > ' : _GEN_FORUMLIST;
          echo '</a> ';
          if (file_exists(KUNENA_ROOT_PATH .DS. 'templates/'.$app->getTemplate().'/images/arrow.png')) {
          echo '<img src="'.KUNENA_JLIVEURL.'/templates/'.$app->getTemplate().'/images/arrow.png" alt="" />';
          } else {
          echo '<img src="'.KUNENA_JLIVEURL.'/images/M_images/arrow.png" alt="" />';
        }
Exemplo n.º 11
0
function showprf($userid, $page)
{
    $fbConfig =& CKunenaConfig::getInstance();
    $kunena_acl =& JFactory::getACL();
    $kunena_my =& JFactory::getUser();
    $kunena_db =& JFactory::getDBO();
    // ERROR: mixed global $fbIcons
    global $fbIcons;
    //Get userinfo needed later on, this limits the amount of queries
    unset($userinfo);
    $kunena_db->setQuery("SELECT a.*, b.* FROM #__fb_users AS a LEFT JOIN #__users AS b ON b.id=a.userid WHERE a.userid='{$userid}'");
    $userinfo = $kunena_db->loadObject();
    check_dberror('Unable to get user profile info.');
    if (!$userinfo) {
        $kunena_db->setQuery("SELECT * FROM #__users WHERE id='{$userid}'");
        $userinfo = $kunena_db->loadObject();
        check_dberror('Unable to get user profile info.');
        if (!$userinfo) {
            echo '<h3>' . _KUNENA_PROFILE_NO_USER . '</h3>';
            return;
        } else {
            // Check moderator status (admin is moderator)
            $aro_group = $kunena_acl->getAroGroup($userid);
            $is_admin = strtolower($aro_group->name) == 'super administrator' || strtolower($aro_group->name) == 'administrator';
            // there's no profile; set userid and moderator status.
            $kunena_db->setQuery("INSERT INTO #__fb_users (userid,moderator) VALUES ('{$userid}','{$is_admin}')");
            $kunena_db->query();
            check_dberror('Unable to create user profile.');
            $kunena_db->setQuery("SELECT a.*, b.* FROM #__fb_users AS a LEFT JOIN #__users AS b ON b.id=a.userid WHERE a.userid='{$userid}'");
            $userinfo = $kunena_db->loadObject();
            check_dberror('Unable to get user profile info.');
            // TODO: For future use
            // echo '<h3>' . _KUNENA_PROFILE_NOT_FOUND . '</h3>';
            // return;
        }
    }
    // User Hits
    $kunena_db->setQuery('UPDATE #__fb_users SET uhits=uhits+1 WHERE userid=' . $userid);
    $kunena_db->query() or trigger_dberror("Unable to update user hits.");
    // get userprofile hits
    $msg_userhits = $userinfo->uhits;
    //get the username:
    $fb_username = "";
    if ($fbConfig->username) {
        $fb_queryName = "username";
    } else {
        $fb_queryName = "name";
    }
    $fb_username = $userinfo->{$fb_queryName};
    $lists["userid"] = $userid;
    $msg_username = $fb_username;
    // $msg_username = ($fmessage->email != "" && $kunena_my->id > 0 && $fbConfig->showemail == '1') ? "<a href=\"mailto:" . $fmessage->email . "\">" . $fb_username . "</a>" : $fb_username;
    if ($fbConfig->allowavatar) {
        $Avatarname = $userinfo->username;
        if ($fbConfig->avatar_src == "jomsocial") {
            // Get CUser object
            $user =& CFactory::getUser($userid);
            $msg_avatar = '<span class="fb_avatar"><img src="' . $user->getAvatar() . '" alt="" /></span>';
        } else {
            if ($fbConfig->avatar_src == "clexuspm") {
                $msg_avatar = '<span class="fb_avatar"><img src="' . MyPMSTools::getAvatarLinkWithID($userid, "b") . '" alt="" /></span>';
            } else {
                if ($fbConfig->avatar_src == "cb") {
                    $kunenaProfile = CKunenaCBProfile::getInstance();
                    $msg_avatar = '<span class="fb_avatar">' . $kunenaProfile->showAvatar($userid, '', 0) . '</span>';
                } else {
                    $avatar = $userinfo->avatar;
                    if ($avatar != '') {
                        if (!file_exists(KUNENA_PATH_UPLOADED . DS . 'avatars/l_' . $avatar)) {
                            $msg_avatar = '<span class="fb_avatar"><img border="0" src="' . KUNENA_LIVEUPLOADEDPATH . '/avatars/' . $avatar . '"  alt="" style="max-width: ' . $fbConfig->avatarwidth . 'px; max-height: ' . $fbConfig->avatarheight . 'px;" /></span>';
                        } else {
                            $msg_avatar = '<span class="fb_avatar"><img border="0" src="' . KUNENA_LIVEUPLOADEDPATH . '/avatars/' . $avatar . '"  alt="" /></span>';
                        }
                    } else {
                        $msg_avatar = '<span class="fb_avatar"><img  border="0" src="' . KUNENA_LIVEUPLOADEDPATH . '/avatars/nophoto.jpg"  alt="" /></span>';
                    }
                }
            }
        }
    }
    if ($fbConfig->showuserstats) {
        //user type determination
        $ugid = $userinfo->gid;
        $uIsMod = 0;
        $uIsAdm = 0;
        if ($ugid > 0) {
            //only get the groupname from the ACL if we're sure there is one
            $agrp = strtolower($kunena_acl->get_group_name($ugid, 'ARO'));
        }
        if ($ugid == 0) {
            $msg_usertype = _VIEW_VISITOR;
        } else {
            if (strtolower($agrp) == "administrator" || strtolower($agrp) == "superadministrator" || strtolower($agrp) == "super administrator") {
                $msg_usertype = _VIEW_ADMIN;
                $uIsAdm = 1;
            } elseif ($uIsMod) {
                $msg_usertype = _VIEW_MODERATOR;
            } else {
                $msg_usertype = _VIEW_USER;
            }
        }
        //done usertype determination, phew...
        //Get the max# of posts for any one user
        $kunena_db->setQuery("SELECT MAX(posts) FROM #__fb_users");
        $maxPosts = $kunena_db->loadResult();
        //# of post for this user and ranking
        $numPosts = (int) $userinfo->posts;
        //ranking
        if ($fbConfig->showranking) {
            if ($userinfo->rank != '0') {
                //special rank
                $kunena_db->setQuery("SELECT * FROM #__fb_ranks WHERE rank_id='{$userinfo->rank}'");
                $getRank = $kunena_db->loadObjectList();
                check_dberror("Unable to load ranks.");
                $rank = $getRank[0];
                $rText = $rank->rank_title;
                $rImg = KUNENA_URLRANKSPATH . $rank->rank_image;
            }
            if ($userinfo->rank == '0') {
                //post count rank
                $kunena_db->setQuery("SELECT * FROM #__fb_ranks WHERE ((rank_min <= '{$numPosts}') AND (rank_special = '0')) ORDER BY rank_min DESC", 0, 1);
                $getRank = $kunena_db->loadObjectList();
                check_dberror("Unable to load ranks.");
                $rank = $getRank[0];
                $rText = $rank->rank_title;
                $rImg = KUNENA_URLRANKSPATH . $rank->rank_image;
            }
            if ($uIsMod) {
                $rText = _RANK_MODERATOR;
                $rImg = KUNENA_URLRANKSPATH . 'rankmod.gif';
            }
            if ($uIsAdm) {
                $rText = _RANK_ADMINISTRATOR;
                $rImg = KUNENA_URLRANKSPATH . 'rankadmin.gif';
            }
            if ($fbConfig->rankimages) {
                $msg_userrankimg = '<img src="' . $rImg . '" alt="" />';
            }
            $msg_userrank = $rText;
            $useGraph = 0;
            //initialization
            if (!$fbConfig->poststats) {
                $msg_posts = '<div class="viewcover">' . "<strong>" . _POSTS . " {$numPosts}" . "</strong>" . "</div>";
                $useGraph = 0;
            } else {
                $myGraph = new phpGraph();
                //$myGraph->SetGraphTitle(_POSTS);
                $myGraph->AddValue(_POSTS, $numPosts);
                $myGraph->SetRowSortMode(0);
                $myGraph->SetBarImg(KUNENA_URLGRAPHPATH . "col" . $fbConfig->statscolor . "m.png");
                $myGraph->SetBarImg2(KUNENA_URLEMOTIONSPATH . "graph.gif");
                $myGraph->SetMaxVal($maxPosts);
                $myGraph->SetShowCountsMode(2);
                $myGraph->SetBarWidth(4);
                //height of the bar
                $myGraph->SetBorderColor("#333333");
                $myGraph->SetBarBorderWidth(0);
                $myGraph->SetGraphWidth(120);
                //should match column width in the <TD> above -5 pixels
                //$myGraph->BarGraphHoriz();
                $useGraph = 1;
            }
        }
    }
    //karma points and buttons
    if ($fbConfig->showkarma && $userid != '0') {
        $karmaPoints = $userinfo->karma;
        $karmaPoints = (int) $karmaPoints;
        $msg_karma = "<strong>" . _KARMA . ":</strong> {$karmaPoints}";
        $msg_karmaminus = '';
        $msg_karmaplus = '';
        if ($kunena_my->id != '0' && $kunena_my->id != $userid) {
            $msg_karmaminus .= "<a href=\"" . JRoute::_(KUNENA_LIVEURLREL . '&amp;func=karma&amp;do=decrease&amp;userid=' . $userid) . "\"><img src=\"";
            if (isset($fbIcons['karmaminus'])) {
                $msg_karmaminus .= KUNENA_URLICONSPATH . $fbIcons['karmaminus'];
            } else {
                $msg_karmaminus .= KUNENA_URLEMOTIONSPATH . "karmaminus.gif";
            }
            $msg_karmaminus .= "\" alt=\"Karma-\" border=\"0\" title=\"" . _KARMA_SMITE . "\" align=\"middle\" /></a>";
            $msg_karmaplus .= "<a href=\"" . JRoute::_(KUNENA_LIVEURLREL . '&amp;func=karma&amp;do=increase&amp;userid=' . $userid) . "\"><img src=\"";
            if (isset($fbIcons['karmaplus'])) {
                $msg_karmaplus .= KUNENA_URLICONSPATH . $fbIcons['karmaplus'];
            } else {
                $msg_karmaplus .= KUNENA_URLEMOTIONSPATH . "karmaplus.gif";
            }
            $msg_karmaplus .= "\" alt=\"Karma+\" border=\"0\" title=\"" . _KARMA_APPLAUD . "\" align=\"middle\" /></a>";
        }
    }
    /*let's see if we should use uddeIM integration */
    if ($fbConfig->pm_component == "uddeim" && $userid && $kunena_my->id) {
        //we should offer the user a PMS link
        //first get the username of the user to contact
        $PMSName = $userinfo->username;
        $msg_pms = "<a href=\"" . JRoute::_('index.php?option=com_uddeim&amp;task=new&recip=' . $userid) . "\"><img src=\"";
        if ($fbIcons['pms']) {
            $msg_pms .= KUNENA_URLICONSPATH . $fbIcons['pms'];
        } else {
            $msg_pms .= KUNENA_URLEMOTIONSPATH . "sendpm.gif";
        }
        $msg_pms .= "\" alt=\"" . _VIEW_PMS . "\" border=\"0\" title=\"" . _VIEW_PMS . "\" /></a>";
    }
    /*let's see if we should use myPMS2 integration */
    if ($fbConfig->pm_component == "pms" && $userid && $kunena_my->id) {
        //we should offer the user a PMS link
        //first get the username of the user to contact
        $PMSName = $userinfo->username;
        $msg_pms = "<a href=\"" . JRoute::_('index.php?option=com_pms&amp;page=new&amp;id=' . $PMSName . '&title=' . $fmessage->subject) . "\"><img src=\"";
        if ($fbIcons['pms']) {
            $msg_pms .= KUNENA_URLICONSPATH . $fbIcons['pms'];
        } else {
            $msg_pms .= KUNENA_URLEMOTIONSPATH . "sendpm.gif";
        }
        $msg_pms .= "\" alt=\"" . _VIEW_PMS . "\" border=\"0\" title=\"" . _VIEW_PMS . "\" /></a>";
    }
    // online - ofline status
    if ($userid > 0) {
        $sql = "SELECT COUNT(userid) FROM #__session WHERE userid='{$userid}'";
        $kunena_db->setQuery($sql);
        $isonline = $kunena_db->loadResult();
        if ($isonline && $userinfo->showOnline == 1) {
            $msg_online = isset($fbIcons['onlineicon']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['onlineicon'] . '" border="0" alt="' . _MODLIST_ONLINE . '" />' : '  <img src="' . KUNENA_URLEMOTIONSPATH . 'onlineicon.gif" border="0"  alt="' . _MODLIST_ONLINE . '" />';
        } else {
            $msg_online = isset($fbIcons['offlineicon']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['offlineicon'] . '" border="0" alt="' . _MODLIST_OFFLINE . '" />' : '  <img src="' . KUNENA_URLEMOTIONSPATH . 'offlineicon.gif" border="0"  alt="' . _MODLIST_OFFLINE . '" />';
        }
    }
    /* ClexusPM integration */
    if ($fbConfig->pm_component == "clexuspm") {
        //we should offer the user a PMS link
        //first get the username of the user to contact
        $PMSName = $userinfo->aid;
        $msg_pms = "<a href=\"" . JRoute::_('index.php?option=com_mypms&amp;task=new&amp;to=' . $userid . '' . $fmessage->subject) . "\"><img src=\"";
        if ($fbIcons['pms']) {
            $msg_pms .= KUNENA_URLICONSPATH . $fbIcons['pms'];
        } else {
            $msg_pms .= KUNENA_JLIVEURL . "/components/com_mypms/images/icons/message_12px.gif";
        }
        $msg_pms .= "\" alt=\"" . _VIEW_PMS . "\" border=\"0\" title=\"" . _VIEW_PMS . "\" /></a>";
        //mypms pro profile link
        $msg_profile = "<a href=\"" . MyPMSTools::getProfileLink($userid) . "\"><img src=\"";
        if ($fbIcons['userprofile']) {
            $msg_profile .= KUNENA_URLICONSPATH . $fbIcons['userprofile'];
        } else {
            $msg_profile .= KUNENA_JLIVEURL . "/components/com_mypms/images/managecontact_icon.gif";
        }
        $msg_profile .= "\" alt=\"" . _VIEW_PROFILE . "\" border=\"0\" title=\"" . _VIEW_PROFILE . "\" /></a>";
        //mypms add buddy link
        $msg_buddy = "<a href=\"" . JRoute::_('index.php?option=com_mypms&amp;user='******'&amp;task=addbuddy') . "\"><img src=\"";
        if ($fbIcons['pms2buddy']) {
            $msg_buddy .= KUNENA_URLICONSPATH . $fbIcons['pms2buddy'];
        } else {
            $msg_buddy .= KUNENA_JLIVEURL . "/components/com_mypms/images/messages/addbuddy.gif";
        }
        $msg_buddy .= "\" alt=\"" . _VIEW_ADDBUDDY . "\" border=\"0\" title=\"" . _VIEW_ADDBUDDY . "\" /></a>";
        $kunena_db->setQuery("SELECT icq, ym, msn, aim, website, location FROM #__mypms_profiles WHERE user='******'");
        $profileitems = $kunena_db->loadObjectList();
        check_dberror("Unable to load mypms_profiles.");
        foreach ($profileitems as $profileitems) {
            if ($profileitems->aim) {
                $msg_aim = "<a href=\"aim:goim?screenname=" . str_replace(" ", "+", $profileitems->aim) . "\"><img src=\"" . KUNENA_URLEMOTIONSPATH . "aim.png\" border=0 alt=\"\" /></a>";
            }
            if ($profileitems->icq) {
                $msg_icq = "<a href=\"http://www.icq.com/whitepages/wwp.php?uin=" . $profileitems->icq . "\"><img src=\"" . KUNENA_URLEMOTIONSPATH . "icq.png\" border=0 alt=\"\" /></a>";
            }
            if ($profileitems->msn) {
                $msg_msn = "<a href=\"" . JRoute::_('index.php?option=com_mypms&amp;task=showprofile&amp;user='******'/plugin/fbprofile/userinfos.php')) {
        include KUNENA_ABSTMPLTPATH . '/plugin/fbprofile/userinfos.php';
    } else {
        include KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'plugin/fbprofile/userinfos.php';
    }
    ?>

            <!-- /Kunena Profile -->
            </td>

            <td class = "<?php 
    echo $boardclass;
    ?>
profile-right" valign="top" width="74%">
            <!-- User Messages -->



            <?php 
    if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/fbprofile/summary.php')) {
        include KUNENA_ABSTMPLTPATH . '/plugin/fbprofile/summary.php';
    } else {
        include KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'plugin/fbprofile/summary.php';
    }
    ?>

                <?php 
    if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/fbprofile/forummsg.php')) {
        include KUNENA_ABSTMPLTPATH . '/plugin/fbprofile/forummsg.php';
    } else {
        include KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'plugin/fbprofile/forummsg.php';
    }
    ?>
            </td>
        </tr>
    </table>

    <?php 
    /*    end of function        */
}
Exemplo n.º 12
0
    /**
     * Main upgrade function. Processes XML file
     */
    function doUpgrade()
    {
        require_once KUNENA_ROOT_PATH . DS . 'includes/domit/xml_domit_lite_include.php';
        if (!$this->silent) {
            ?>
			<script language=JavaScript>
			function showDetail(srcElement) {
				var targetID, srcElement, targetElement, imgElementID, imgElement;
				targetID = srcElement.id + "_details";
				imgElementID = srcElement.id + "_img";

				targetElement = document.getElementById(targetID);
				imgElement = document.getElementById(imgElementID);
				if (targetElement.style.display == "none") {
					targetElement.style.display = "";
					imgElement.src = "images/collapseall.png";
				} else {
					targetElement.style.display = "none";
					imgElement.src = "images/expandall.png";
				}
			}
			</script>
			<style>
			.details {
				font-family: courier;
				background-color: #EEEEEE;
				border: 1px dashed #BBBBBB;
				padding-left: 10px;
				margin-left: 20px;
				margin-top: 5px;
			</style>
			<?php 
        }
        $componentBaseDir = KUNENA_ROOT_PATH_ADMIN . DS . 'components/';
        $this->_upgradeDir = $componentBaseDir . $this->component . DS . $this->subdir;
        $versionTableNoPrefix = $this->versionTablePrefix . "version";
        //get current version, check if version table exists
        $createVersionTable = 1;
        $upgrade = null;
        $kunena_db =& JFactory::getDBO();
        $kunena_db->setQuery("SHOW TABLES LIKE '%" . $versionTableNoPrefix . "'");
        $kunena_db->query() or trigger_dberror('Unable to check for existing version table.');
        if ($kunena_db->loadResult()) {
            //table already exists, so do not create a new table
            $createVersionTable = 0;
            // lets see if we need to update the version table layout from it original
            $currentVersion = $this->getLatestVersion($this->versionTable);
            if (!is_object($currentVersion)) {
                // version table exisits, but we cannot retrieve the latest version
                // in this case we assume the table layout might have changed
                // backup old table and create new version table
                $this->backupVersionTable();
                $this->dropVersionTable();
                $this->createVersionTable();
                // insert dummy version info to start with
                $this->insertDummyVersion();
            }
            //check for latest version and date entry
            $currentVersion = $this->getLatestVersion($this->versionTable);
            if (!$currentVersion->version && !$currentVersion->versiondate) {
                //there was an error in retrieving the version and date, goto install mode
                $upgrade = 0;
            } else {
                //OK, no error, there is a version table and it also contains version and date information, switching to upgrade mode
                $upgrade = 1;
            }
        }
        //Create version table
        if ($createVersionTable == 1) {
            if (!$this->createVersionTable()) {
                $this->_error = "DB function failed with error number <b>" . $kunena_db->_errorNum . "</b><br/>";
                $this->_error .= $kunena_db->getErrorMsg();
                $img = "publish_x.png";
                $this->_return = false;
            } else {
                $img = "tick.png";
            }
            if (!$this->silent) {
                ?>
				<table class="adminlist">
				<tr>
					<td>Creating version table</td>
					<td width="20"><a href="#" onMouseOver="return overlib('<?php 
                echo $this->_error;
                ?>
', BELOW, RIGHT,WIDTH,300);" onmouseout="return nd();" ><img src="images/<?php 
                echo $img;
                ?>
" border="0"></a></td>
				</tr>
				</table>
				<?php 
            }
        }
        //initiate XML doc
        $xmlDoc = new DOMIT_Lite_Document();
        $xmlDoc->loadXML($this->_upgradeDir . DS . $this->xmlFileName, false, true);
        //load root element and check XML version (for future use)
        $root =& $xmlDoc->documentElement;
        $comUpgradeVersion = $root->getAttribute("version");
        //here comes the real stuff
        if ($upgrade == 0) {
            $installElement =& $root->firstChild;
            $version = $installElement->getAttribute("version");
            $versiondate = $installElement->getAttribute("versiondate");
            $build = $installElement->getAttribute("build");
            $versionname = $installElement->getAttribute("versionname");
            //Store version info and date in database
            $this->insertVersionData($version, $versiondate, $build, $versionname);
            if (!$this->silent) {
                ?>
				<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
				<script  type="text/javascript" src="<?php 
                echo JURI::root();
                ?>
/includes/js/overlib_mini.js"></script>
				<table class="adminlist">
					<tr>
						<th colspan="2">Installing "<?php 
                echo $this->component;
                ?>
" (Version: <?php 
                echo $version;
                ?>
 / Date: <?php 
                echo $versiondate;
                ?>
 / Build: <?php 
                echo $build;
                ?>
 / VersionName: <?php 
                echo $versionname;
                ?>
 )</th>
					</tr>
				<?php 
            }
            //install mode, run install queries
            $installElement = $root->getElementsByPath('install', 1);
            if (!is_null($installElement)) {
                $this->processNode($installElement, 1);
            }
            if (!$this->silent) {
                ?>
				</table>
				<?php 
            }
        } else {
            if (!$this->silent) {
                ?>
				<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
				<script  type="text/javascript" src="<?php 
                echo JURI::root();
                ?>
/includes/js/overlib_mini.js"></script>
				<table class="adminlist">
					<tr>
						<th colspan="2">Upgrading "<?php 
                echo $this->component;
                ?>
" (Version: <?php 
                echo @$currentVersion->version;
                ?>
 / Version Date: <?php 
                echo @$currentVersion->versiondate;
                ?>
 / Install Date: <?php 
                echo @$currentVersion->installdate;
                ?>
 / Build: <?php 
                echo @$currentVersion->build;
                ?>
 / Version Name: <?php 
                echo @$currentVersion->versionname;
                ?>
)</th>
					</tr>
				<?php 
            }
            //upgrade mode
            $upgradeElement = $root->getElementsByPath('upgrade', 1);
            if (!is_null($upgradeElement)) {
                //walk through the versions
                $numChildrenMain =& $upgradeElement->childCount;
                $childNodesMain =& $upgradeElement->childNodes;
                for ($k = 0; $k < $numChildrenMain; $k++) {
                    $versionElement =& $childNodesMain[$k];
                    $version = $versionElement->getAttribute("version");
                    $versiondate = $versionElement->getAttribute("versiondate");
                    $build = $versionElement->getAttribute("build");
                    $versionname = $versionElement->getAttribute("versionname");
                    //when legacy version exists, just compare version, if date exists as well, compare date
                    if ($currentVersion->versiondate && $versiondate > $currentVersion->versiondate or version_compare($version, $currentVersion->version, '>') or version_compare($version, $currentVersion->version, '==') && $build > $currentVersion->build) {
                        //these instructions are for a newer version than the currently installed version
                        if (!$this->silent) {
                            ?>
							<tr>
								<td colspan="2">&nbsp;</td>
							</tr>
							<tr>
								<th colspan="2">Version: <?php 
                            echo $version;
                            ?>
 (Version Date: <?php 
                            echo $versiondate;
                            ?>
, Build: <?php 
                            echo $build;
                            ?>
, Version Name: <?php 
                            echo $versionname;
                            ?>
)</th>
							</tr>
							<?php 
                        }
                        //Store version info and date in database
                        $this->insertVersionData($version, $versiondate, $build, $versionname);
                        $this->processNode($versionElement, $k);
                    }
                    //end if version newer check
                }
                //end version element loop
            }
            //end if !is_null($upgradeElement)
            if (!$this->silent) {
                ?>
				</table>
				<?php 
            }
        }
        //end main if upgrade or not
        return $this->_return;
    }
}
$kunena_db->setQuery("TRUNCATE #__fb_favorites");
$kunena_db->query();
$kunena_db->setQuery("ALTER TABLE `#__fb_favorites` DROP INDEX `thread`");
$kunena_db->query();
$kunena_db->setQuery("ALTER TABLE `#__fb_favorites` ADD UNIQUE `thread`(`thread`,`userid`)");
$kunena_db->query() or trigger_dberror("Não é possível alterar a tabela fb_favorites, por favor entre em contato com a equipe do Kunena em www.kunena.com!");
if ($temporary) {
    $kunena_db->setQuery("INSERT INTO #__fb_favorites (thread,userid) SELECT thread, userid FROM #__fb_favorites_temp");
    $kunena_db->query() or trigger_dbwarning("Não é possível fixar a tabela fb_favorites. Todos os favoritos serão removidos.");
    $kunena_db->setQuery("DROP TABLE #__fb_favorites_temp");
    $kunena_db->query() or trigger_dbwarning("Não foi possível remover a tabela temporária (#__fb_favorites_temp).");
}
$temporary = 1;
$kunena_db->setQuery("CREATE TABLE #__fb_subscriptions_temp SELECT thread, userid, future1 FROM #__fb_subscriptions WHERE userid>0 GROUP BY thread, userid");
if ($kunena_db->query() == FALSE) {
    $temporary = 0;
    trigger_dbwarning("Não é possível fixar a tabela fb_subscriptions. Todas as inscrições serão removidas.");
}
$kunena_db->setQuery("TRUNCATE #__fb_subscriptions");
$kunena_db->query();
$kunena_db->setQuery("ALTER TABLE `#__fb_subscriptions` DROP INDEX `thread`");
$kunena_db->query();
$kunena_db->setQuery("ALTER TABLE `#__fb_subscriptions` ADD UNIQUE `thread`(`thread`,`userid`)");
$kunena_db->query() or trigger_dberror("Não é possível alterar a tabela fb_subscriptions, por favor entre em contato com a equipe do  Kunena em www.kunena.com!");
if ($temporary) {
    $kunena_db->setQuery("INSERT INTO #__fb_subscriptions (thread,userid,future1) SELECT thread, userid, future1 FROM #__fb_subscriptions_temp");
    $kunena_db->query() or trigger_dbwarning("Não é possível fixar a tabela fb_subscriptions. Todas as inscrições serão removidas.");
    $kunena_db->setQuery("DROP TABLE #__fb_subscriptions_temp");
    $kunena_db->query() or trigger_dbwarning("Não foi possível remover a tabela temporária (#__fb_subscriptions_temp).");
}