webbuild: fixes for sociallog from webbuild.db
This commit is contained in:
parent
5a0fa63a96
commit
1c15fcfb25
@ -137,12 +137,6 @@ if [ "$USER_ENABLED" != "1" -a "${REQUEST:0:7}" != "refresh" ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then
|
|
||||||
. $WEBBUILD_STATEDIR/users/webbuild.state
|
|
||||||
else
|
|
||||||
touch $WEBBUILD_STATEDIR/users/webbuild.state
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then
|
if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then
|
||||||
if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then
|
if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then
|
||||||
set_user_state_var STATE_FAKEUSER
|
set_user_state_var STATE_FAKEUSER
|
||||||
@ -209,7 +203,7 @@ fi
|
|||||||
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
|
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
|
||||||
if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then
|
if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then
|
||||||
curl -s "$WEBBUILD_URL?REQUEST=refreshsocial&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&FROMID=$FROMID"
|
curl -s "$WEBBUILD_URL?REQUEST=refreshsocial&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&FROMID=$FROMID"
|
||||||
else
|
else
|
||||||
[ -e "$WEBBUILD_STATEDIR/webbuild.db" ] || exit
|
[ -e "$WEBBUILD_STATEDIR/webbuild.db" ] || exit
|
||||||
# social box
|
# social box
|
||||||
echo -n "<socialbox>"
|
echo -n "<socialbox>"
|
||||||
@ -217,13 +211,13 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
|
|||||||
if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then
|
if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then
|
||||||
# Find id of last row - 25
|
# Find id of last row - 25
|
||||||
if [ "$USER" ]; then
|
if [ "$USER" ]; then
|
||||||
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE id!='$USER' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
|
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE user!='$USER' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
|
||||||
else
|
else
|
||||||
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE target!='$DEVELOPERS' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
|
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE target!='developers' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
|
||||||
fi
|
fi
|
||||||
FROMID=`sqlite3 $WEBBUILD_STATEDIR/webbuild.db "$LASTID_QUERY"`
|
FROMID=`sqlite3 $WEBBUILD_STATEDIR/webbuild.db "$LASTID_QUERY"`
|
||||||
fi
|
fi
|
||||||
sqlite3 $WEBBUILD_STATEDIR/webbuild.db "select *,strftime('%s',time) from social_log where id>$FROMID" | while read line; do
|
sqlite3 $WEBBUILD_STATEDIR/webbuild.db "SELECT *,strftime('%s',time) FROM social_log WHERE id>$FROMID LIMIT 100" | while read line; do
|
||||||
SAVEIFS=$IFS
|
SAVEIFS=$IFS
|
||||||
IFS="|"
|
IFS="|"
|
||||||
set -- $line
|
set -- $line
|
||||||
@ -236,7 +230,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
|
|||||||
STEXT="$7"
|
STEXT="$7"
|
||||||
STIME="$9"
|
STIME="$9"
|
||||||
[ "$STARGET" = "developers" -a ! "$USER" ] && continue
|
[ "$STARGET" = "developers" -a ! "$USER" ] && continue
|
||||||
[ "$SUSER" = "$USER" -a "$STARGET" == "developers" ] && continue
|
[ "$SUSER" = "$USER" -a "$STARGET" = "developers" ] && continue
|
||||||
if [ "$SPRIVACY" -a ! "$USER" ]; then
|
if [ "$SPRIVACY" -a ! "$USER" ]; then
|
||||||
USER_GRAVATAR=
|
USER_GRAVATAR=
|
||||||
else
|
else
|
||||||
@ -473,7 +467,7 @@ fi
|
|||||||
if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then
|
if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then
|
||||||
# external (autodist) social messages
|
# external (autodist) social messages
|
||||||
[ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage
|
[ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage
|
||||||
social_log "SUSER=$USER STYPE=$MESSAGETYPE SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
|
social_log "SUSER=$USER STYPE=$MESSAGETYPE STARGET=\"$TARGET\" SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
|
||||||
echo "</webbuild>"
|
echo "</webbuild>"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -48,7 +48,7 @@ function social_log() {
|
|||||||
eval $line
|
eval $line
|
||||||
USER_SECRET_FIXED=`echo $USER_SECRET | sed "s|\$|\\$|"`
|
USER_SECRET_FIXED=`echo $USER_SECRET | sed "s|\$|\\$|"`
|
||||||
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&\
|
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&\
|
||||||
MESSAGE=`cgi_encodevar \"$STEXT\"`" >/dev/null
|
TARGET=$STARGET&MESSAGE=`cgi_encodevar \"$STEXT\"`" >/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user