Fork me on GitHub


 Bas   Précédent   Suivant

(1) 2 3 4 ... 21 »


Création d'un block pour un module (SmallWorld)
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
Bonjour les xoopsiens,

Maintenant que j'ai réussi à installer smallworld sur mon site, je souhaiterais en faire un block pour en assouplir l'utilisation.

N'étant pas un pro, j'ai récupérer les codes de 2 fichiers:
smallworld_index.tpl et index.php.

J'ai créer dans Xoops_Version:
// Blocks
$modversion['blocks'][] = [
    
'file'        => 'smallworld_block.php',
    
'name'        => 'Smallworld',
    
'description' => 'This is a Block for SmallWorld',
    
'show_func'   => 'smallworld_blocklist',
    
'template'    => 'smallworld_block.tpl',


Puis le fichier smallworld_block.php dans Smallworld/include
<?php
/**
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

/**
 * SmallWorld
 *
 * @copyright    The XOOPS Project (https://xoops.org)
 * @copyright    2011 Culex
 * @license      GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/)
 * @package      SmallWorld
 * @since        1.0
 * @author       Michael Albertsen (http://culex.dk) <culex@culex.dk>
 */

use XmfRequest;
use 
Xoopsmodulessmallworld;

require_once 
XOOPS_ROOT_PATH '/modules/smallworld/header.php';
require_once 
XOOPS_ROOT_PATH '/mainfile.php';

require_once 
XOOPS_ROOT_PATH '/modules/smallworld/include/functions.php';
require_once 
XOOPS_ROOT_PATH '/modules/smallworld/class/class_collector.php';
require_once 
XOOPS_ROOT_PATH '/modules/smallworld/class/PublicWallUpdates.php';
global 
$xoopsUser$xoTheme$xoopsConfig$xoopsLogger$xoopsModule;

$set smallworld_checkPrivateOrPublic();

if (
$xoopsUser) {
    
$GLOBALS['xoopsOption']['template_main'] = 'smallworld_index.tpl';
} elseif (!
$xoopsUser && == $set['access']) {
    
$GLOBALS['xoopsOption']['template_main'] = 'smallworld_publicindex.html';
} else {
    
redirect_header(XOOPS_URL '/user.php'5_NOPERM);
}
require_once 
XOOPS_ROOT_PATH '/header.php';
if (
== $set['access']) {
    
$id    $xoopsUser $xoopsUser->getVar('uid') : 0;
    
$user  = new XoopsUser($id);
    
$dBase = new smallworldSmallWorldDB;

    
// Check if inspected userid -> redirect to userprofile and show admin countdown
    
$inspect Smallworld_isInspected($id);
    if (
'yes' === $inspect['inspect']) {
        
redirect_header('userprofile.php?username=' $xoopsUser->getVar('uname'), 1);
    }

    
$xoopsTpl->assign('ownerofpage'$id);
    if (
$xoopsUser) {
        if (
$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
            
$xoopsTpl->assign('isadminuser''YES');
            
$profile 2;
        } else {
            
$xoopsTpl->assign('isadminuser''NO');
        }
    }
}
    
// Create form for private settings
    
$form         = new smallworldSmallWorldForm;
    
$usersettings $form->usersettings($id$selected null);
    
$xoopsTpl->assign('usersetting'$usersettings);

    
$username $user->getVar('uname');
    
$check    = new smallworldSmallWorldUser;
    
$profile  $xoopsUser $check->CheckIfProfile($id) : 0;

    if (
$profile >= 2) {
        
$xuser = new smallworldSmallWorldProfile;
        
$xuser->ShowUser($id);
        
$menu_startpage "<a href='" XOOPS_URL "/modules/smallworld/publicindex.php'><img id='menuimg' src='" XOOPS_URL "/modules/smallworld/assets/images/highrise.png'>" _SMALLWORLD_STARTPAGE '</a>';
        
$menu_home      "<a href='" XOOPS_URL "/modules/smallworld/'><img id='menuimg' src='" XOOPS_URL "/modules/smallworld/assets/images/house.png'>" _SMALLWORLD_HOME '</a>';
        
$menu_profile   "<a href='" XOOPS_URL '/modules/smallworld/userprofile.php?username=' $username "'><img id='menuimg' src='" XOOPS_URL "/modules/smallworld/assets/images/user_silhouette.png'>" _SMALLWORLD_PROFILEINDEX '</a>';
        
$menu_gallery   "<a href='" XOOPS_URL '/modules/smallworld/galleryshow.php?username=' $username "'><img id='menuimg' src='" XOOPS_URL "/modules/smallworld/assets/images/picture.png'>" _SMALLWORLD_GALLERY '</a>';
        
$menu_friends   "<a href='" XOOPS_URL '/modules/smallworld/friends.php?username=' $username "'><img id='menuimg' src='" XOOPS_URL "/modules/smallworld/assets/images/group.png'>" _SMALLWORLD_FRIENDSPAGE '</a>';
    }

    
// Things to do with wall
    
$Wall = ($profile >= 2) ? new smallworldWallUpdates() : new smallworldPublicWallUpdates();
    if (
$profile && == $set['access']) {
        
$pub          smallworld_checkUserPubPostPerm();
        
$updatesarray $Wall->Updates(0$pub);
    } else {
        
// Follow array here
        
$followers    Smallworld_array_flatten($Wall->getFollowers($id), 0);
        
$updatesarray $Wall->Updates(0$id$followers);
    }

    
//Get friends invitations
    
$getInvitations $xoopsUser $check->getRequests($id) : 0;
    
$Wall->ParsePubArray($updatesarray$id);

    if (
$profile >= 2) {
        
$xoopsTpl->assign('menu_startpage'$menu_startpage);
        
$xoopsTpl->assign('menu_home'$menu_home);
        
$xoopsTpl->assign('menu_profile'$menu_profile);
        
$xoopsTpl->assign('menu_friends'$menu_friends);
        
$xoopsTpl->assign('menu_gallery'$menu_gallery);
    }
    
$xoopsTpl->assign('myusername'$username);
    
$xoopsTpl->assign('pagename''index');
    
$xoopsTpl->assign('check'$profile);

    
$xoopsTpl->assign('friendinvitations'$getInvitations);
    
$xoopsTpl->assign('access'$set['access']);

    
//    }

if (== $profile && == $set['access']) {
    
redirect_header(XOOPS_URL '/modules/smallworld/register.php');
}

 if (
$profile == && $set['access'] <= 1) {
 
redirect_header(XOOPS_URL "/modules/smallworld/register.php");
 }

if (
== $profile && == $set['access']) {
    
redirect_header(XOOPS_URL "/user.php"1_NOPERM);
}

require_once 
XOOPS_ROOT_PATH '/footer.php';


Et le fichier smallworld_block.tpl dans Smallworld/
<{if $xoops_isuser}>
<{if 
$check 1}>
<
ul id="smallworld_menu" class="smallworld_menu">
    <
li class="active">
        <
a href="<{$xoops_url}>/modules/smallworld/index.php"><{$smarty.const._SMALLWORLD_HOME}></a>
    </
li>
</
ul>
<
div id="example1" class="smallworld_content">
    <
table class="smallworld_biotable">
        <
tr>
            <
td>
                <{
$avatar}>
                <
div class="UploadNewAvatar" id="<{$ownerofpage}>" style="display:none">
                    <
div id="smallworld_avatarupload">
                        <
span><{$smarty.const._SMALLWORLD_UPLOADFILEBUTTONTEXT}></span>
                    </
div>
                    <
span id="smallworld_avatarstatus"></span>
                    <
ul id="smallworld_avatarfiles"></ul>

                </
div>
                <
div class="smallworld_userstat_menu">
                    <
h1><{$username}></h1>
                    <
div style="text-align: center;"><{$rankimage}></div>
                    <
br>
                    <
div style="text-align: center;"><{$smarty.const._SMALLWORLD_TOTALPOSTS}>
                        <{
$totalposts}>
                    </
div>
                    <
br><br>
                    <
h1><{$smarty.const._SMALLWORLD_TOTALUSERRATINGS}></h1>
                    <
class="smallworld_rating_menu"><{$usersratinf}></p>
                </
div>
                <
br>

                <{if 
$isadminuser == 'YES' || $username == $myusername}>
                <
br>
                <
class="smallworld_useredits_menu">
                    <
img height="10px" width="10px" src="assets/images/editavatar.png">
                    <
a href="javascript:void(0);" id="smallworld_changeAvatar"><{$smarty.const._SMALLWORLD_CHANGEAVATAR}></a><br>
                    <
img height="10px" width="10px" src="assets/images/edituserprofile.png">
                    <
a href="editprofile.php" id="smallworld_changeEditProfile"><{$smarty.const._SMALLWORLD_EDITPROFILE}></a><br>
                    <
img height="10px" width="10px" src="assets/images/preferences.png">
                    <
a href="javascript:void(0);" id="smallworld_changePersSettings"><{$smarty.const._SMALLWORLD_MENU_PRIVSET}></a>
                    <
br>
                </
p>
                <{/if}>
                <
br>
                <
class="smallworld_useredits_menu">
                    <
img width='10px' height='10px' src="<{$xoops_url}>/modules/smallworld/assets/images/statistics.png">
                    <
a href="javascript:void(0);" id="smallworld_statistics_lnk"><{$smarty.const._SMALLWORLD_STATS}></a><br>
                </
p>
                <
br>
            </
td>

            <
span class="smallworld_search">
                     <
td>
                        <
ul class="smallworld_index_headmenu">
                            <
li><{$menu_startpage}></li>
                            <
li><{$menu_home}></li>
                            <
li><{$menu_profile}></li>
                            <
li><{$menu_friends}></li>
                            <
li><{$menu_gallery}></li>    
                        </
ul>
                        <
br>
                        <
br>
                        
                        <
div style="text-align: center;"><input id="smallworld_searchform" size="35" type="text" value="<{$smarty.const._SMALLWORLD_SEARCHMEMBER}>"></div>
                        <
br>
                        <
br>
                                <
div id="smallworld_wall_container">
                                    <
div id="smallworld_updateboxarea">
                                        <
h4><{$smarty.const._SMALLWORLD_WHATSUP}></h4>
                                        <
form method="post" action="">
                                            <
textarea cols="50" rows="1" rel="<{$ownerofpage}>" name="smallworld_update" id="smallworld_update"></textarea>
                                            <
br>
                                            <
div id="smallworld_updatePrivacyCheck">
                                                <
label for="updatePriv"><{$smarty.const._SMALLWORLD_PRIVATEUPDATE}></label>
                                                <
input type="radio" name="updatePublic" id="updatePublic" value="1">
                                                <
label for="updatePriv"><{$smarty.const._SMALLWORLD_PUBLICUPDATE}></label>
                                                <
input type="radio" name="updatePublic" id="updatePublic" value="0">
                                                <
img id="smallworld_tagIMG" src="https://cdn3.iconfinder.com/data/icons/diagram_v2/PNG/96x96/diagram_v2-06.png" height="15px" width="15px" title="Insert tags for this update">
                                                
                                            </
div>   
<
ul style="display:none" id="tags_input">
                                                </
ul>                                            
                                            <
br><br>
                                            <
input type="submit" value="<{$smarty.const._SMALLWORLD_UPDATEBUTTONTEXT}>" id="smallworld_update_button" class="smallworld_update_button">
                                        </
form>
                                    </
div>
                                    <
hr>
                                    <
div id="smallworld_Stats_container"></div>
                                    <
button id='smallworld_messagecounter_id' onClick='smallworldRefresh();return false;'></button>
                                    <
div id='smallworld_flashmessage'>
                                        <
div id="smallworld_flash" align="left"></div>
                                    </
div>                                        
                                <
div id="smallworld_content">                                                                                            
                                 <{foreach 
item=post from=$walldata}>
                                <
div class="smallworld_stbody" id="smallworld_stbody<{$post.msg_id}>">
                                    <
script type="text/javascript"
                                            
xoops_smallworld(document).ready(function () {
                                                
xoops_smallworld('#smallworld_stexpand<{$post.msg_id}>').oembed('<{$post.orimessage}>', {
                                                    
embedMethod'fill',
                                                    
maxWidth"100%",
                                                    
maxHeight"100%"
                                                
});
                                            });
                                    
</script>
                                    <div class="smallworld_stimg">
                                        <img src="<{$post.avatar_link}>" class='smallworld_big_face' <{$post.avatar_highwide}>>
                                    </div> 
                                <div class="smallworld_sttext">                                       
                                    <{if $isadminuser == 'YES' || $post.username == $myusername}>
                                        <a class="smallworld_stdelete" href="#" rel="<{$post.uid_fk}>" id="<{$post.msg_id}>" title="<{$smarty.const._SMALLWORLD_DELUPD}>">X</a>
                                    <{/if}>
                                        <a href="<{$post.permalink}>"> <img style="height:10px; width:10px" src="<{$post.linkimage}>"> </a>
                                    <b><a class="smallworld_wall_link" href="<{$xoops_url}>/modules/smallworld/userprofile.php?username=<{$post.username}>"><{$post.username}></a></b> <{$post.message}>
                                    <div class="smallworld_sttime"><{$post.created}> <{$post.sharelink}> | <a href='#' class='smallworld_commentopen' id='<{$post.msg_id}>' title='<{$smarty.const._SMALLWORLD_COMMENTWALL}>'><{$smarty.const._SMALLWORLD_COMMENTWALL}></a></div>
                                    <{$post.sharediv}>
                                    <{if $post.username == $myusername}>
                                        <div class="smallworld_stcommentvote">                                            
                                            <span id="smallworld_votenum"><{$post.vote_up}></span>
                                                <img class="smallworld_voteimg" src="assets/images/like.png">
                                            
                                            <span id="smallworld_votenum"><{$post.vote_down}></span>
                                                <img class="smallworld_voteimg" src="assets/images/dislike.png">
                                        </div>    
                                    <{else}>
                                    <div class="smallworld_stcommentvote">                                            
                                            <span id="smallworld_votenum"><{$post.vote_up}></span> <a href="javascript:void(0)" name="up" class="smallworld_stcomment_vote" id="<{$post.msg_id}>" type="msg" owner="<{$post.uid_fk}>">
                                                <img class="smallworld_voteimg" src="assets/images/like.png">
                                            </a>
                                            <span id="smallworld_votenum"><{$post.vote_down}></span> <a href="javascript:void(0)" name="down" class="smallworld_stcomment_vote" id="<{$post.msg_id}>" type="msg" owner="<{$post.uid_fk}>">
                                                <img class="smallworld_voteimg" src="assets/images/dislike.png">
                                            </a>
                                            <a href="javascript:void(0)" auserid="<{$post.uid_fk}>" by_user="<{$myusername}>" a_user="<{$post.username}>" name="complaint" class="smallworld_comment_complaint" id="<{$post.compl_msg_lnk}>">
                                                <img class="smallworld_voteimg" src="assets/images/complaint.png">
                                            </a>                                                
                                    </div>
                                    <{/if}>
                                    <div id="smallworld_stexpandbox">
                                        <div id="smallworld_stexpand<{$post.msg_id}>"></div>
                                    </div>

                                    <div class="smallworld_commentcontainer" id="smallworld_commentload<{$post.msg_id}>">

                                        <{section name=i loop=$comm}>
                                            <{if $comm[i].msg_id_fk == $post.msg_id}>
                                            <div class="smallworld_stcommentbody" id="smallworld_stcommentbody<{$comm[i].com_id}>">
                                                <div class="smallworld_stcommentimg">
                                                <img src="<{$comm[i].avatar_link}>" class='smallworld_small_face' <{$comm[i].avatar_highwide}>>
                                                </div> 
                                                <div class="smallworld_stcommenttext">
                                                    <{if $isadminuser == 'YES' or $comm[i].username == $myusername}>    
                                                    <a class="smallworld_stcommentdelete" href="#" rel="<{$comm[i].uid}>" id='<{$comm[i].com_id}>' title='<{$smarty.const._SMALLWORLD_DELETECOMMENT}>'>X</a>
                                                    <{/if}>
                                                    <div class="comm_holder">
                                                    <a class="smallworld_wall_link" href="<{$xoops_url}>/modules/smallworld/userprofile.php?username=<{$comm[i].username}>">
                                                        <b><{$comm[i].username}></b>
                                                    </a> <{$comm[i].comment}></div>                                                
                                                        <div class="smallworld_stcommenttime"><{$comm[i].time}></div>
                                                         <{if $comm[i].username == $myusername}>    
                                                            <div class="smallworld_stcommentvote">
                                                                <span id="smallworld_votenum"><{$comm[i].vote_up}></span>
                                                                    <img class="smallworld_voteimg" src="assets/images/like.png">
                                                                
                                                                
                                                                <span id="smallworld_votenum"><{$comm[i].vote_down}></span>
                                                                    <img class="smallworld_voteimg" src="assets/images/dislike.png">
                                                            </div>
                                                         <{else}>
                                                          <div class="smallworld_stcommentvote">
                                                                <span id="smallworld_votenum"><{$comm[i].vote_up}></span> <a href="javascript:void(0)" name="up" class="smallworld_stcomment_vote" id="<{$comm[i].com_id}>" owner="<{$comm[i].uid}>" type="com" type2="<{$comm[i].msg_id_fk}>">
                                                                    <img class="smallworld_voteimg" src="assets/images/like.png">
                                                                </a>
                                                                
                                                                <span id="smallworld_votenum"><{$comm[i].vote_down}></span> <a href="javascript:void(0)" name="down" class="smallworld_stcomment_vote" id="<{$comm[i].com_id}>" owner="<{$comm[i].uid}>" type="com" type2="<{$comm[i].msg_id_fk}>">
                                                                    <img class="smallworld_voteimg" src="assets/images/dislike.png">
                                                                </a>
                                                                <a href="javascript:void(0)" auserid="<{$comm[i].uid}>" by_user="<{$myusername}>" a_user="<{$comm[i].username}>" name="complaint" class="smallworld_comment_complaint" id="<{$comm[i].compl_msg_lnk}>">
                                                                    <img class="smallworld_voteimg" src="assets/images/complaint.png">
                                                                </a>                                                             
                                                          </div>
                                                         <{/if}>
                                                </div>
                                            </div>
                                            <{/if}>
                                        <{/section}>
                                    </div>
                                    
                                    <div class="smallworld_commentupdate" style="display:none" id="smallworld_commentbox<{$post.msg_id}>">
                                        <div class="smallworld_stcommentimg">
                                            <img src="<{$myavatarlink}>" class='smallworld_small_face' width="35px" height="35px">
                                        </div> 
                                        <div class="smallworld_stcommenttext">
                                            <form method="post" action="">
                                                <textarea name="smallworld_comment" class="smallworld_comment" id="smallworld_ctextarea<{$post.msg_id}>"></textarea>
                                                <br>
                                                <input type="submit" value="<{$smarty.const._SMALLWORLD_COMMENTBUTTONTEXT}>" id="<{$post.msg_id}>" class="smallworld_comment_button">
                                            </form>
                                        </div>
                                    </div>
                                    
                                </div> 

                                </div>
                                
                                 <{/foreach}>
                                <div id="smallworld_moremsg_ajax" style="display:none">
                                    <img src="assets/images/loader.gif">
                                </div>
                                <a href="javascript:void(0)" class="smallworld_msg_counter" rel2="" rel="<{$pagename}>" id="<{$post.msg_id}>"><{$smarty.const._SMALLWORLD_MOREBUTTONLINK}></a>
                                    </div>
</div>
</td>
</span>
</tr>
</table>
</div>
<div id="friendInvitations_box" title="<{$smarty.const._SMALLWORLD_FRIENDSINVITATIONS}>">
    <table border="0" class="smallworld_invitetable" cellspacing="0" cellpadding="0">
        <tr>
            <th><{$smarty.const._SMALLWORLD_REALNAME}></th>
            <th></th>
            <th><{$smarty.const._SMALLWORLD_DATERECIEVED}></th>
            <th></th>
            <th> <{$smarty.const._SMALLWORLD_ACTION}></th>
            <th></th>
        </tr>
        <{foreach item=post from=$friendinvitations}>
        <tr id="smallworldfriendrequest_<{$post.friendname}>">
            <td><{$post.friendname}></td>
            <td><{$post.friendimage}></td>
            <td><{$post.frienddate}></td>
            <td><{$post.accept}></td>
            <td><{$post.deny}></td>
            <td><{$post.later}></td>
        </tr>
        <{/foreach}>
    </table>
</div>
<{$usersetting}>
<div id="smallworldStatsDiv" title="<{$smarty.const._SMALLWORLD_STATS}>" style="display:none;"></div>
<{else}>
<div id="smallworld_notyetregistered" title="<{$smarty.const._SMALLWORLD_NOTYETREGISTERED_TITLE}>">
    <table border="0" class="smallworld_table" cellspacing="0" cellpadding="0">
        <tr>
            <label for="register"></label>
            <td><p id="smallworld_notyetusercontent"><{$smarty.const._SMALLWORLD_NOTYETUSER_BOXTEXT}></p></td>
        </tr>
    </table>
</div>
<{/if}>
<{/if}>

J'obitens l'erreur
ErrorErrorCall to a member function assign() on null in file /modules/smallworld/blocks/smallworld_block.php line 55


qui correspond au code:
$xoopsTpl->assign('ownerofpage'$id);


Et j'obtiens la même erreur a chaque fois qu'on fait référence à $xoopsTpl

Je suis un apprenti et je ne maitrise clairement pas les tpl, je bricole en général et j'apprends. J'ai du râter quelquechose quelque part.

Je vous remercie par avance pour votre aide.
Bonne fin de journée.
Cordialement,

Sébastien

Posté le : 16/11/2020 17:10
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
Merci. Installé, parfait.
Je continue de suivre le module en espérant qu'il sera maintenu.

Posté le : 16/11/2020 16:38
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
Bonjour Alain,

Si j ai bien compris, j’ai fait ce qu’il fallait comme il le fallait?????

Et j’avoue que la réponse a été très rapide de la part de Mambax qui a déjà fait beaucoup pour essayer de debuger tout ça.

J’en profite pour remercier toute l’équipe derrière Xoops que je suis et utilise depuis plus de 10ans. J’ai toujours trouvé tout le support nécessaire, et toujours dans un bon état d’esprit. Ce n est pas l’endroit pour le dire, mais quand même, merci à vous de toujours être là pour les petits développeurs du dimanche comme moi????

Posté le : 30/03/2020 21:41
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
En fait le lien fonctionne, mais en utilisant un VPN. Je ne sais pas pourquoi... l ip du site est bloquée en Europe...

Posté le : 30/03/2020 21:32
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
En fait le lien fonctionne, mais en utilisant un VPN. Je ne sais pas pourquoi... l ip du site est bloquée en Europe...

Posté le : 30/03/2020 21:31
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
Bonjour Alain,

Merci pour cette proposition, je vais aller voir si ils font ce que je cherche. (ce qui me plait dans SmallWorld, c'est vraiment le coté mur interractif avec partage possible de ce qu'on veut, genre facebook)

J'ai déjà un gestionnaire photos et articles (Les modules de Tad(http://campus-xoops.tn.edu.tw/index.php)

Je suis un "voyageur" on va dire, mon site est destiné a mes amis et à ma famille, pour que je puisse écrire des articles sur mes peripeties, leur montrer avec les photos.
La seule chose que je n'ai pas, c'est la possibilité d'intér agir en direct.

Je vais aller voir ce que vous me proposez. Merci pour la piste de recherche.


Posté le : 30/03/2020 01:43
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
Mambax s'intérresse à mon problème ICI
avec une nouvelle version: ICI

Malheureusement, il y a d'autres bugs :(
Une toute petite connexion 3G, beaucoup de mal a travailler la dessus. Je viens d'arriver à la frontière avec le Brésil, je verrai demain si j'ai un peu plus de temps et si j'arrive à négocier la connexion du voisin :)
Bonne soirée à tous, je vous tiens au courant de mes avancées.

Posté le : 30/03/2020 00:42
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
Bonjour Caesag et merci pour çà.
(J'avais fait pareil ici: https://github.com/XoopsModules25x/smallworld/issues/4
Mais je n'étais pas au bon endroit apparemment)
Merci pour le suivi en tout cas.
Bonne fin de journée.

Sébastien

Posté le : 28/03/2020 15:17
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
Bonjour JJDAI et Ceasag (et le reste du forum), et merci de vous interresser à mon problème.

Smallworld est un module permettant d'avoir un mur facon facebook, un fils d'actualités. Développé par Culex.
Vous pouvez le voir en action ici: Culex
(la dernière version est téléchargeable au même endroit).
C'est un vieux module qui ne semble pas avoir été actualisé depuis 2 ans.

Je suis humanitaire, et mon site a pour but de partager mes photos et articles avec mes amis, la famille. Et ce module me permettrait d'avoir des intéractions en direct avec eux, directement sur la page principale du site, d'ou mon interet :)) (Je pars demain à la frontière entre la Guyane et le Brésil en renfort sur les centres de santé)

Culex avait développé Xim en meme temps, une espece d'instant messenger. A l'époque je n'avais pas réussi à le faire fonctionner(Xim) parce qu'il rentrait en conflit avec les modules de Tad que j'utilise beaucoup)

JJDAI, je vais faire les modifications que tu me donne et voir si j'arrive à le faire fonctionner.

Merci à tous en tout cas de vous être penché sur mon problème.
Bonne fin de journée.

Posté le : 28/03/2020 14:00
Transférer la contribution vers d'autres applications Transférer


Re: Smallworld Error : Error: Class 'PublicWallUpdates' not found
Régulier
Inscrit: 17/12/2008 10:55
Messages: 203
Bon ben... les bons reflexes ne reviennent pas :):)
Donc effectivement le class PublicWallUpdates{ est bien dans le PublicWallUpdate.php
Je continue de chercher, mais si jamais quelqu'un repère une erreur en survolant le truc, j'ai l'impression que je passe à côté d'un truc tout bête... (Peut être un conflit avec les modules de tad que j'utilise à côté...)
Merci par avance a ceux qui prendront le temps de jeter un oeil et à ceux qui l'ont déja fait.
Et je vais tester sur une installation neuve.

<?php namespace Xoopsmodulessmallworld;
/**
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

/**
 * SmallWorld
 *
 * @copyright    The XOOPS Project (https://xoops.org)
 * @copyright    2011 Culex
 * @license      GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/)
 * @package      SmallWorld
 * @since        1.0
 * @author       Michael Albertsen (http://culex.dk) <culex@culex.dk>
 */
// Moderated and fitted from the tutorial by Srinivas Tamada http://9lessons.info

class PublicWallUpdates{
    private function 
getAdminModerators()
    {
        global 
$xoopsDB$xoopsUser;
        
$sql    'SELECT userid
                FROM ' 
$xoopsDB->prefix('smallworld_user') . ' su
                LEFT JOIN ' 
$xoopsDB->prefix('groups_users_link') . ' xu ON su.userid = xu.uid
                WHERE xu.uid IN (1)'
;
        
$result $xoopsDB->queryF($sql);
        while (
$row $xoopsDB->fetchArray($result)) {
            
$data[] = $row;
        }
    }

    
/**
     * Get arry of users being inspected
     *
     *
     */

    
public function inspected()
    {
        global 
$xoopsDB;
        
$sql    'SELECT userid FROM ' $xoopsDB->prefix('smallworld_admin') . ' WHERE (inspect_start+inspect_stop) > ' time() . '';
        
$result $xoopsDB->queryF($sql);
        
$data   = [];
        while (
$row $xoopsDB->fetchArray($result)) {
            
$data[] = $row;
        }
        if (!empty(
$data)) {
            
$sub implode(','Smallworld_array_flatten(array_unique($data), 0));
        } else {
            
$sub 0;
        }
        return 
$sub;
    }

    
/**
     * @Get array of updates
     * @param int   $last
     * @param  array $moderators
     * @return array|bool
     */
    
public function Updates($last$moderators)
    {
        global 
$xoopsUser$xoopsDB$moduleConfig$xoopsLogger;
        
$moderators is_array($moderators) ? $moderators : [$moderators];
        
$hm         smallworld_GetModuleOption('msgtoshow');
        
$set        smallworld_checkPrivateOrPublic();
        
$mods       implode(','Smallworld_array_flatten(array_unique($moderators), 0));
        
$inspected  $this->inspected();
        
$perm       smallworld_GetModuleOption('smallworldshowPoPubPage');
        
$i          0;

        if (
== $last) {
            
$query 'SELECT M.msg_id, M.uid_fk, M.priv, M.message, M.created, U.username FROM '
                     
$xoopsDB->prefix('smallworld_messages')
                     . 
' M, '
                     
$xoopsDB->prefix('smallworld_user')
                     . 
' U WHERE M.uid_fk=U.userid AND M.uid_fk IN ('
                     
$mods
                     
') AND M.uid_fk NOT IN ('
                     
$inspected
                     
") AND M.priv = '0'";
        } elseif (
$last 0) {
            
$query 'SELECT M.msg_id, M.uid_fk, M.priv, M.message, M.created, U.username FROM '
                     
$xoopsDB->prefix('smallworld_messages')
                     . 
' M, '
                     
$xoopsDB->prefix('smallworld_user')
                     . 
' U  WHERE M.uid_fk=U.userid AND M.uid_fk IN ('
                     
$mods
                     
') AND M.uid_fk NOT IN ('
                     
$inspected
                     
") AND M.priv = '0' AND M.msg_id < '"
                     
$last
                     
"'";
        } elseif (
'a' == $last) {
            
$query 'SELECT M.msg_id, M.uid_fk, M.priv, M.message, M.created, U.username FROM '
                     
$xoopsDB->prefix('smallworld_messages')
                     . 
' M, '
                     
$xoopsDB->prefix('smallworld_user')
                     . 
' U  WHERE M.uid_fk=U.userid AND M.uid_fk IN ('
                     
$mods
                     
') AND M.uid_fk NOT IN ('
                     
$inspected
                     
") AND M.priv = '0'";
        }

        if (
$last 0) {
            
$query .= ' order by created DESC LIMIT ' $hm;
        } elseif (
'a' == $last) {
            
$query .= ' order by M.msg_id DESC LIMIT ' $hm;
        } else {
            
$query .= ' order by created DESC LIMIT ' $hm;
        }

        
$result $xoopsDB->queryF($query);
        
$count  $xoopsDB->getRowsNum($result);
        if (
== $count) {
            return 
false;
        } else {
            while (
$row $xoopsDB->fetchArray($result)) {
                
$data[] = $row;
            }

            if (!empty(
$data)) {
                return 
$data;
            }
        }
    }

    
/**
     * @Get comments based on msg id
     * @param int $msg_id
     * @return array
     */
    
public function Comments($msg_id)
    {
        global 
$xoopsUser$xoopsDB;
        
$inspected $this->inspected();
        
$query     'SELECT C.msg_id_fk, C.com_id, C.uid_fk, C.comment, C.created, U.username FROM '
                     
$xoopsDB->prefix('smallworld_comments')
                     . 
' C, '
                     
$xoopsDB->prefix('smallworld_user')
                     . 
" U WHERE C.uid_fk=U.userid AND C.msg_id_fk='"
                     
$msg_id
                     
"' AND C.uid_fk NOT IN ("
                     
$inspected
                     
') ORDER BY C.com_id ASC ';
        
$result    $xoopsDB->queryF($query);
        
$i         $xoopsDB->getRowsNum($result);
        while (
$row $xoopsDB->fetchArray($result)) {
            
$data[] = $row;
        }
        if (!empty(
$data)) {
            return 
$data;
        }
    }

    
/**
     * @Get user image based on uid
     * @param int $uid
     * @return string
     */
    
public function Gravatar($uid)
    {
        global 
$xoopsUser$xoopsDB;
        
$image  '';
        
$sql    'SELECT userimage FROM ' $xoopsDB->prefix('smallworld_user') . " WHERE userid = '" $uid "'";
        
$result $xoopsDB->queryF($sql);
        while (
$r $xoopsDB->fetchArray($result)) {
            
$image $r['userimage'];
        }

        if (
'blank.gif' === $image) {
            
$image smallworld_getAvatarLink($uid$image);
        }

        
//$image = ($image == '' || $image == 'blank.gif') ? smallworld_getAvatarLink($uid, $image) : $image;

        
$type = [
            
=> 'jpg',
            
=> 'jpeg',
            
=> 'png',
            
=> 'gif'
        
];

        
$ext explode('.'$image);

        if (@!
in_array(strtolower($ext[1]), $type) || '' == $image) {
            
$avatar '';
        } else {
            
$avatar $image;
        }
        return 
$avatar;
    }

    
/**
     * @count all votes
     * @param int $type
     * @param int $val
     * @param int $msgid
     * @return int
     */
    
public function countVotes($type$val$msgid)
    {
        global 
$xoopsUser$xoopsDB;
        
$sum 0;
        
$query  'Select SUM(' $val ') as sum from ' $xoopsDB->prefix('smallworld_vote') . " where msg_id = '" $msgid "' and com_id = '0'";
        
$result $xoopsDB->queryF($query);
        while (
$row $xoopsDB->fetchArray($result)) {
            
$sum $row['sum'];
        }
        if (
'' == $sum) {
            
$sum 0;
        }
        return 
$sum;
    }

    
/**
     * @Count comments votes
     * @param int $type
     * @param int $val
     * @param int $comid
     * @param int $msgid
     * @returns int
     */
    
public function countVotesCom($type$val$comid$msgid)
    {
        global 
$xoopsUser$xoopsDB;
        
$sum 0;
        
$query  'Select SUM(' $val ') as sum from ' $xoopsDB->prefix('smallworld_vote') . " where com_id = '" $comid "' AND msg_id = '" $msgid "'";
        
$result $xoopsDB->queryF($query);
        while (
$row $xoopsDB->fetchArray($result)) {
            
$sum $row['sum'];
        }
        if (
'' == $sum) {
            
$sum 0;
        }
        return 
$sum;
    }

    
/**
     * @Check is user is friend
     * @param int    $userid
     * @param string $type
     * @param int    $comid
     * @param int    $msgid
     * @return int
     */
    
public function HasVoted($userid$type$comid$msgid)
    {
        global 
$xoopsUser$xoopsDB;
        if (
'msg' === $type) {
            
$sql    'SELECT * FROM ' $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '0' AND msg_id = '" $msgid "' AND user_id = '" $userid "'";
            
$result $xoopsDB->queryF($sql);
            
$i      $xoopsDB->getRowsNum($result);
        } else {
            
$sql    'SELECT * FROM ' $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '" $comid "' AND msg_id = '" $msgid "' AND user_id = '" $userid "'";
            
$result $xoopsDB->queryF($sql);
            
$i      $xoopsDB->getRowsNum($result);
        }
        return 
$i;
    }

    
/**
     * @count messages per user
     * @param int $userid
     * @return int
     */
    
public function CountMsges($userid)
    {
        global 
$xoopsDB;
        
$sql    'SELECT (SELECT COUNT(*) FROM ' $xoopsDB->prefix('smallworld_comments') . " WHERE uid_fk = '" $userid "') + (SELECT COUNT(*) FROM " $xoopsDB->prefix('smallworld_messages') . " WHERE uid_fk = '" $userid "')";
        
$result $xoopsDB->queryF($sql);
        
$sum    $xoopsDB->fetchRow($result);
        return 
$sum[0];
    }

    
/**
     * @Show permaling updates
     * @param int $updid
     * @param int $uid
     * @param int $ownerID
     * @return array|bool
     */
    
public function UpdatesPermalink($updid$uid$ownerID)
    {
        global 
$xoopsUser$xoopsDB$moduleConfig;
        
$query  'SELECT M.msg_id, M.uid_fk, M.message, M.created, M.priv, U.username FROM ' $xoopsDB->prefix('smallworld_messages') . ' M, ' $xoopsDB->prefix('smallworld_user') . " U  WHERE M.uid_fk=U.userid AND M.uid_fk='" $ownerID "'";
        
$query  .= " AND M.msg_id = '" $updid "'";
        
$query  .= ' order by M.created DESC LIMIT 1';
        
$result $xoopsDB->queryF($query);
        
$count  $xoopsDB->getRowsNum($result);
        if (
$count 1) {
            return 
false;
        } else {
            while (
$row $xoopsDB->fetchArray($result)) {
                
$data[] = $row;
            }
            if (!empty(
$data)) {
                return 
$data;
            }
        }
    }

    
/**
     * @Get share link
     * @param int $updid
     * @param int $ownerID
     * @return array|bool
     */
    
public function UpdatesSharelink($updid$ownerID)
    {
        global 
$xoopsUser$xoopsDB$moduleConfig;
        
$query  'SELECT M.msg_id, M.uid_fk, M.message, M.created, M.priv, U.username FROM ' $xoopsDB->prefix('smallworld_messages') . ' M, ' $xoopsDB->prefix('smallworld_user') . " U WHERE M.uid_fk=U.userid AND M.uid_fk='" $ownerID "' AND M.priv = 0";
        
$query  .= " AND M.msg_id = '" $updid "'";
        
$query  .= ' order by created DESC LIMIT 1';
        
$result $xoopsDB->queryF($query);
        
$count  $xoopsDB->getRowsNum($result);
        if (
$count 1) {
            return 
false;
        } else {
            while (
$row $xoopsDB->fetchArray($result)) {
                
$data[] = $row;
            }
            if (!empty(
$data)) {
                return 
$data;
            }
        }
    }

    
/**
     * @Get sharing link
     * @param int $id
     * @param int $priv
     * @return string
     */
    
public function GetSharing($id$priv)
    {
        if (
!= $priv) {
            
$text " | <span class='smallworld_share' id='smallworld_share'>";
            
$text .= "<a class='share' id='share-page" $id "' href='javascript:void(0);'>" _SMALLWORLD_SHARELINK '</a></span>';
        } else {
            
$text '';
        }
        return 
$text;
    }

    
/**
     * @Get content for sharing div
     * @param int    $id
     * @param int    $priv
     * @param string $permalink
     * @param string $desc
     * @param string $username
     * @return string
     */
    
public function GetSharingDiv($id$priv$permalink$desc$username)
    {
        if (
!= $priv) {
            
$text "<div style='display: none;' class='smallworld_bookmarks' id='share-page' name='share-page" $id "'>";
            
$text .= "<span name='share-page" $id "' rel1='" $desc "' rel2= '" $username "' rel=" $permalink " id='basicBookmark' title='" _SMALLWORLD_SHAREBOX_TITLE "'>";
            
$text .= '</span></div>';
        } else {
            
$text '';
        }
        return 
$text;
    }

    
/**
     * @Parse update and comments array to template for public updates
     * @param array $updatesarray
     * @param int   $id
     * @return void
     */
    
public function ParsePubArray($updatesarray$id)
    {
        global 
$xoopsUser$xoopsTpl$tpl$xoopsModule$xoopsTpl$xoopsConfig;
        
$wm = [];
        
$check          = new SmallWorldUser;
        
$dBase          = new SmallWorldDB;
        
$profile        $xoopsUser $check->checkIfProfile($id) : 0;
        
$moduleHandler xoops_getHandler('module');
        
$module         $moduleHandler->getByDirname('smallworld');
        
$configHandler xoops_getHandler('config');
        
$moduleConfig   $configHandler->getConfigsByCat(0$module->getVar('mid'));

        
$myavatar          $this->Gravatar($id);
        
$myavatarlink      smallworld_getAvatarLink($id$myavatar);
        
$myavatar_size     smallworld_getImageSize(80100$myavatarlink);
        
$myavatar_highwide smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 100);
        
$user_img          "<img src='" smallworld_getAvatarLink($id$myavatar) . "' id='smallworld_user_img' " $myavatar_highwide '>';

        
$xoopsTpl->assign('myavatar'$myavatar);
        
$xoopsTpl->assign('myavatarlink'$myavatarlink);
        
$xoopsTpl->assign('myavatar_highwide'$myavatar_highwide);
        
$xoopsTpl->assign('avatar'$user_img);

        if (!empty(
$updatesarray)) {
            foreach (
$updatesarray as $data) {

                
// Is update's user a friend ?
                
$frU $check->friendcheck($id$data['uid_fk']);

                
$USW             = [];
                
$USW['posts']    = 0;
                
$USW['comments'] = 0;

                if (
$xoopsUser) {
                    if (
$xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) {
                        
$USW['posts']    = 1;
                        
$USW['comments'] = 1;
                        
$frU[0]          = 2;
                    } else {
                        
$USW json_decode($dBase->GetSettings($data['uid_fk']), true);
                    }
                }

                if (!
$xoopsUser) {
                    
$USW json_decode($dBase->GetSettings($data['uid_fk']), true);
                }

                
$wm['msg_id']          = $data['msg_id'];
                
$wm['orimessage']      = (== $USW['posts'] || $profile >= 2) ? str_replace(["r""n"], ''Smallworld_stripWordsKeepUrl($data['message'])) : '';
                
$wm['message']         = (== $USW['posts'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETPOSTS;
                
$wm['message']         = Smallworld_cleanup($wm['message']);
                
$wm['created']         = smallworld_time_stamp($data['created']);
                
$wm['username']        = $data['username'];
                
$wm['uid_fk']          = $data['uid_fk'];
                
$wm['priv']            = $data['priv'];
                
$wm['avatar']          = $this->Gravatar($data['uid_fk']);
                
$wm['avatar_link']     = smallworld_getAvatarLink($data['uid_fk'], $wm['avatar']);
                
$wm['avatar_size']     = smallworld_getImageSize(80100$wm['avatar_link']);
                
$wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50);
                
$wm['vote_up']         = $this->countVotes('msg''up'$data['msg_id']);
                
$wm['vote_down']       = $this->countVotes('msg''down'$data['msg_id']);
                
$wm['sharelinkurl']    = XOOPS_URL '/modules/smallworld/smallworldshare.php?ownerid=' $data['uid_fk'];
                
$wm['sharelinkurl']    .= '&updid=' $data['msg_id'] . '';
                
$wm['usernameTitle']   = $wm['username'] . _SMALLWORLD_UPDATEONSITEMETA $xoopsConfig['sitename'];
                if (
== $USW['posts'] || $profile >= 2) {
                    
$wm['sharelink'] = $this->GetSharing($wm['msg_id'], $wm['priv']);
                } else {
                    
$wm['sharelink'] = $this->GetSharing($wm['msg_id'], 1);
                }

                if (
== $USW['posts'] || $profile >= 2) {
                    
$wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], $wm['priv'], $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']);
                } else {
                    
$wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], 1$wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']);
                }
                
$wm['linkimage']     = XOOPS_URL '/modules/smallworld/assets/images/link.png';
                
$wm['permalink']     = XOOPS_URL '/modules/smallworld/permalink.php?ownerid=' $data['uid_fk'] . '&updid=' $data['msg_id'];
                
$wm['commentsarray'] = $this->Comments($data['msg_id']);

                if (
== $frU[0] || == $USW['posts']) {
                    
$xoopsTpl->append('walldata'$wm);
                }

                if (!empty(
$wm['commentsarray'])) {
                    foreach (
$wm['commentsarray'] as $cdata) {
                        
// Is commentuser a friend ?
                        
$frC $check->friendcheck($id$cdata['uid_fk']);

                        
$USC             = [];
                        
$USC['posts']    = 0;
                        
$USC['comments'] = 0;

                        if (
$xoopsUser) {
                            if (
$xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $cdata['uid_fk'] == $id) {
                                
$USC['posts']    = 1;
                                
$USC['comments'] = 1;
                                
$frC[0]          = 2;
                            } else {
                                
$USC json_decode($dBase->GetSettings($cdata['uid_fk']), true);
                            }
                        }

                        if (!
$xoopsUser) {
                            
$USC json_decode($dBase->GetSettings($cdata['uid_fk']), true);
                        }

                        
$wc['msg_id_fk']       = $cdata['msg_id_fk'];
                        
$wc['com_id']          = $cdata['com_id'];
                        
$wc['comment']         = (== $USC['comments'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($cdata['comment']), $cdata['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS;
                        
$wc['comment']         = Smallworld_cleanup($wc['comment']);
                        
$wc['time']            = smallworld_time_stamp($cdata['created']);
                        
$wc['username']        = $cdata['username'];
                        
$wc['uid']             = $cdata['uid_fk'];
                        
$wc['myavatar']        = $this->Gravatar($id);
                        
$wc['myavatar_link']   = $myavatarlink;
                        
$wc['avatar_size']     = smallworld_getImageSize(80100$wc['myavatar_link']);
                        
$wc['avatar_highwide'] = smallworld_imageResize($wc['avatar_size'][0], $wc['avatar_size'][1], 35);
                        
$wc['cface']           = $this->Gravatar($cdata['uid_fk']);
                        
$wc['avatar_link']     = smallworld_getAvatarLink($cdata['uid_fk'], $wc['cface']);
                        
$wc['vote_up']         = $this->countVotesCom('com''up'$cdata['msg_id_fk'], $cdata['com_id']);
                        
$wc['vote_down']       = $this->countVotesCom('com''down'$cdata['msg_id_fk'], $cdata['com_id']);

                        if (
== $frC[0] || == $USC['comments']) {
                            
$xoopsTpl->append('comm'$wc);
                        }
                    }
                }
            }
        }
    }
}



En debug, j'ai du rouge de Queries, pas d'erreurs:

0.000306 - ALTER TABLE smallworld_comments CHANGE 'comments' 'comments' TEXT
Error number: 1064
Error message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''comments' 'comments' TEXT' at line 1



Posté le : 26/03/2020 22:06
Transférer la contribution vers d'autres applications Transférer



 Haut
(1) 2 3 4 ... 21 »




Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

35 Personne(s) en ligne (21 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 35 | Plus ...