OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/09/2025 11:18:49 AM
rwxr-xr-x
📄
.htaccess
860 bytes
12/09/2024 12:36:01 PM
rw-r--r--
📁
.vscode
-
11/09/2024 12:33:02 PM
rwxrwxr-x
📄
12-03-25index.php
42.58 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
13-03-25index.php
56.24 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
13-03-25premium.php
18.76 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
14-4-25-whatsappBot
-
05/19/2025 10:07:21 AM
rwxr-xr-x
📄
15-4-25-index.php
54.17 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
23-04-25stream.php
70.87 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
3-4-25-index.php
62.26 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
9_12_24index.html
11.48 KB
12/09/2024 05:56:43 AM
rw-r--r--
📄
A_index.php
65.56 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
Arv_stream.php
67.28 KB
05/19/2025 10:07:22 AM
rw-r--r--
📁
CreateLeadPage
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📁
CreateLeadPage_back
-
05/19/2025 10:07:19 AM
rwxr-xr-x
📁
CreatePage
-
05/19/2025 10:07:15 AM
rwxrwxrwx
📄
ImageMagick-7.1.1-45-Q16-HDRI-x64-dll.exe
22.2 MB
03/17/2025 09:25:42 AM
rw-r--r--
📁
NLEditor
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📄
Scheduled_posts.php
49.78 KB
06/16/2025 08:52:51 AM
rw-r--r--
📁
Xpress
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
XpressPage.php
47.18 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
Xpress_backup
-
05/19/2025 10:07:19 AM
rwxrwxrwx
📄
about.html
3.7 KB
12/10/2024 09:17:27 AM
rw-r--r--
📄
account.php
56.45 KB
06/17/2025 10:30:23 AM
rw-r--r--
📄
activate.php
4.63 KB
05/19/2025 10:07:19 AM
rw-r--r--
📄
add_channel.php
9.71 KB
05/19/2025 10:07:19 AM
rw-r--r--
📄
add_to_channel.php
980 bytes
05/19/2025 10:07:22 AM
rw-r--rw-
📁
admin
-
05/19/2025 10:07:22 AM
rwxrwxr-x
📄
analytics.php
38.23 KB
05/19/2025 10:07:19 AM
rw-rw-r--
📁
api
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
arvind_index.php
4.44 KB
05/19/2025 10:07:15 AM
rw-r--r--
📁
assets
-
04/17/2025 09:15:05 AM
rwxrwxr-x
📁
audio
-
05/27/2025 07:33:37 AM
rwxrwxrwx
📁
avatars
-
04/14/2025 06:26:27 PM
rwxr-xr-x
📁
aws-ses
-
05/19/2025 10:07:21 AM
rwxr-xr-x
📄
b_account.php
45.4 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
b_himanshu_process_data.php
5.02 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
b_himanshu_stream.php
70.67 KB
05/19/2025 10:07:21 AM
rw-r--r--
📄
b_settings.php
74.3 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
baccount.php
38.98 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
back_\index.php
40.34 KB
05/19/2025 10:07:15 AM
rw-r--r--
📁
back_aws-ses
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📁
back_whatsappBot
-
05/19/2025 10:07:16 AM
rwxrwxrwx
📄
badd_channel.php
10.01 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
bfeatured_channels.php
31.33 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
bfeatured_topics.php
28.47 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
blogInCheck.php
2.12 KB
05/19/2025 10:07:21 AM
rw-rw-r--
📄
bsign-in.php
21.47 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
businessLp.php
46.33 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
bussLp.php
57.87 KB
05/19/2025 10:07:19 AM
rw-r--r--
📄
card-news.php
6.39 KB
05/19/2025 10:07:22 AM
rw-rw-r--
📄
channel.php
60.43 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
chattest.php
8.8 KB
05/19/2025 10:07:19 AM
rw-rw-r--
📄
checkSession.php
1.52 KB
05/19/2025 10:07:19 AM
rw-r--r--
📁
clients
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📄
collections.php
94.92 KB
05/19/2025 10:07:21 AM
rw-r--r--
📄
comments.php
1.67 KB
05/19/2025 10:07:21 AM
rw-rw-r--
📄
composer.json
101 bytes
03/25/2025 08:44:52 AM
rw-rw-r--
📄
composer.lock
5.68 KB
03/25/2025 08:44:51 AM
rw-rw-r--
📄
contact.html
3.44 KB
03/12/2025 11:48:10 AM
rw-r--r--
📄
cookie.php
750 bytes
05/19/2025 10:07:19 AM
rw-r--r--
📄
copytest.html
4.05 KB
11/09/2024 12:48:18 PM
rw-rw-r--
📁
creamAdmin
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📄
cream_dashboard.php
26.3 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
creamapi
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📄
create.php
43.85 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
created_magazine.html
11.96 KB
11/09/2024 12:48:18 PM
rw-rw-r--
📄
dashboard.php
55.97 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
data
-
05/19/2025 10:07:13 AM
rwxrwxrwx
📄
dbms.php
492.73 KB
05/20/2025 01:55:35 PM
rw-r--r--
📄
down.html
1.23 KB
11/12/2024 02:39:28 AM
rw-r--r--
📄
edit_post.php
2.19 KB
06/13/2025 12:59:41 PM
rw-r--r--
📄
featured_channels.php
32.68 KB
05/19/2025 10:07:21 AM
rw-r--r--
📄
featured_topics.php
26.66 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
fetch_articles.php
1.83 KB
05/19/2025 10:07:22 AM
rw-rw-r--
📄
fetch_liked_users.php
1.55 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
files_with_warning.txt
25.17 KB
05/19/2025 10:06:22 AM
rw-r--r--
📄
filter.php
4.92 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
follow_action.php
1.7 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
follow_dash.php
33.92 KB
05/19/2025 10:07:22 AM
rw-r--r--
📁
form-builder
-
05/19/2025 10:07:19 AM
rwxr-xr-x
📄
function.php
20.61 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
gemini.php
38.21 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
genai
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
generated_article.php
11.92 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
get_recent_items.php
1.37 KB
05/19/2025 10:07:16 AM
rw-r--r--
📁
groupchat
-
05/19/2025 10:07:13 AM
rwxrwxr-x
📄
handle_channel.php
856 bytes
05/19/2025 10:07:13 AM
rw-r--rw-
📄
himanshu_)newsletter.php
23.31 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
himanshu_analytics.php
28.88 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
himanshu_process_data.php
6.46 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
himanshu_stream.php
72.33 KB
05/19/2025 10:07:15 AM
rw-r--r--
📁
hindiConverter
-
05/19/2025 10:07:19 AM
rwxr-xr-x
📄
homePin.php
68.59 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
hps
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
impmy_collection.php
124.44 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
inc
-
05/19/2025 10:07:13 AM
rwxrwxr-x
📄
index.php
54.5 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
influencer.php
12.23 KB
05/19/2025 10:07:16 AM
rw-r--r--
📁
interface
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📄
ipsh.php
1.52 KB
05/22/2025 07:25:43 AM
rw-r--r--
📁
kannada
-
05/19/2025 10:07:15 AM
rwxrwxr-x
📄
knobly_logo.png
9.45 KB
03/18/2025 08:18:45 AM
rw-r--r--
📁
knobly_scribe
-
05/19/2025 10:07:19 AM
rwxr-xr-x
📁
knoblysocial
-
05/19/2025 10:07:16 AM
rwxrwxrwx
📄
landing_page.php
17.3 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
landing_signin.php
5.14 KB
05/19/2025 10:07:16 AM
rw-r--r--
📁
landingpage
-
03/02/2025 02:01:39 PM
rwxr-xr-x
📁
leadpage
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
link.php
5.63 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
log.txt
60 bytes
04/25/2025 09:10:22 AM
rw-r--r--
📄
logInCheck.php
7.33 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
loggedInCheck.php
1.15 KB
05/19/2025 10:07:19 AM
rw-rw-r--
📄
logo (1).svg
814 bytes
01/16/2025 05:26:43 AM
rw-r--r--
📄
logout.php
1.14 KB
05/19/2025 10:07:15 AM
rw-rw-r--
📄
magazine.html
4.6 KB
11/09/2024 12:48:19 PM
rw-rw-r--
📄
magazine.php
23.69 KB
05/19/2025 10:07:13 AM
rw-rw-r--
📄
more.php
9.62 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
my_collection.php
153.95 KB
06/04/2025 06:38:10 AM
rw-r--r--
📄
my_collection_backup.php
149.76 KB
05/19/2025 10:07:21 AM
rw-r--r--
📄
my_settings.php
17.57 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
navbar.php
3.36 KB
05/19/2025 10:07:21 AM
rw-r--r--
📄
new-page.php
15.14 KB
06/04/2025 09:56:42 AM
rw-r--r--
📄
newEditor.php
17.04 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
new_cream
-
05/19/2025 10:07:21 AM
rwxr-xr-x
📁
new_ui
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
newsletter.php
24.9 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
old_sendy
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
old_stream.php
94.19 KB
05/19/2025 10:07:22 AM
rw-r--r--
📁
pageLanding
-
02/04/2025 01:03:32 PM
rwxr-xr-x
📁
pages
-
05/19/2025 10:07:13 AM
rwxrwxrwx
📄
payment.php
29.87 KB
05/20/2025 02:34:50 PM
rw-r--r--
📁
pdf
-
03/12/2025 12:11:01 PM
rwxr-xr-x
📄
pdftk_server-2.02-win-setup.exe
2.91 MB
03/17/2025 09:44:38 AM
rw-r--r--
📄
persona_submit.php
963 bytes
05/19/2025 10:07:13 AM
rw-r--r--
📄
personaform.php
7.03 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
post-details.php
38.06 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
ppayment.php
31.42 KB
05/20/2025 01:52:50 PM
rw-r--r--
📄
premium.php
21.88 KB
05/19/2025 10:07:19 AM
rw-r--r--
📄
premium_test.php
28.94 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
privacy.html
12.52 KB
12/10/2024 09:17:06 AM
rw-r--r--
📄
private_channel.php
10.06 KB
06/04/2025 07:19:28 AM
rw-r--r--
📄
private_dashboard.php
56.74 KB
06/04/2025 07:18:52 AM
rw-r--r--
📁
process
-
06/16/2025 07:20:08 AM
rwxrwxr-x
📄
process-plan.php
1.44 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
process-scheduled-posts.php
2.02 KB
06/13/2025 01:08:04 PM
rw-r--r--
📄
process.php
1.47 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
process_data.php
5.21 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
profile.php
38.01 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
profile_pic_upload.php
4.85 KB
05/19/2025 10:07:19 AM
rw-r--r--
📄
profile_test.php
19.88 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
publish_scheduled_posts.php
1.17 KB
05/19/2025 10:07:21 AM
rw-r--r--
📁
quiz
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📁
reader
-
03/04/2025 08:32:49 AM
rwxr-xr-x
📄
reader.php
67.62 KB
05/19/2025 10:07:15 AM
rw-r--r--
📁
reels
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
referralInfo.php
5.88 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
referralProcess.php
1.07 KB
05/19/2025 10:07:21 AM
rw-r--r--
📄
refund.html
9.47 KB
02/17/2025 10:22:24 AM
rw-r--r--
📄
replyPost.php
3.93 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
report
-
05/19/2025 10:07:21 AM
rwxr-xr-x
📄
request_article.php
24.18 KB
05/19/2025 10:07:19 AM
rw-rw-r--
📄
reset.html
5.09 KB
11/12/2024 04:10:05 AM
rw-r--r--
📄
revsh.php
71 bytes
05/20/2025 03:42:26 PM
rw-r--r--
📄
save_profile.php
2.78 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
saved.php
34.49 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
schedule-post.php
1.49 KB
06/13/2025 01:07:17 PM
rw-r--r--
📄
search_bar.php
17.52 KB
05/19/2025 10:07:21 AM
rw-r--r--
📁
sendy
-
05/27/2025 10:22:07 AM
rwxr-xr-x
📄
settings.php
82.29 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
share.html
2.4 KB
05/08/2025 09:43:24 AM
rw-r--r--
📄
sharemarket.php
3.94 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
showcase.php
10.62 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
shreyasStream.php
68.54 KB
05/19/2025 10:07:19 AM
rw-r--r--
📁
side_navbar_testing
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
sign-in.php
47.67 KB
06/17/2025 10:29:25 AM
rw-r--r--
📄
signInProcess.php
13.91 KB
06/17/2025 10:17:00 AM
rw-rw-r--
📄
signInProcess_backup.php
11.12 KB
05/19/2025 10:07:19 AM
rw-r--r--
📁
social_media
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
start.html
3.99 KB
12/13/2024 10:07:49 AM
rw-rw-r--
📄
store_articles.php
987 bytes
05/19/2025 10:07:19 AM
rw-rw-r--
📄
stream.php
94.49 KB
06/16/2025 11:47:53 AM
rw-r--r--
📄
streamPush.php
30.16 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
submit.php
734 bytes
05/19/2025 10:07:19 AM
rw-r--r--
📄
test.php
1.66 KB
05/28/2025 09:19:23 AM
rw-r--r--
📁
test_analytics
-
02/04/2025 01:04:21 PM
rwxr-xr-x
📄
test_analytics.php
35.92 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
test_create.php
40.38 KB
05/19/2025 10:07:19 AM
rw-r--r--
📄
test_create_LP.php
14.07 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
test_index.php
56.5 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
test_new-page.php
1.61 KB
05/24/2025 05:28:20 PM
rw-r--r--
📄
test_new_analytics.php
35.92 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
test_premium.php
14.65 KB
05/19/2025 10:07:21 AM
rw-r--r--
📄
test_profile.php
14.55 KB
05/19/2025 10:07:22 AM
rw-rw-r--
📄
test_request_article.php
28.23 KB
05/19/2025 10:07:15 AM
rw-r--r--
📄
test_search_bar.php
12.27 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
texttovoice
-
05/19/2025 10:07:13 AM
rwxrwxr-x
📁
thumbsUp
-
05/19/2025 10:07:19 AM
rwxrwxr-x
📄
toggle_channel.php
2.28 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
transcript
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
udupi_sign_up.php
34.95 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
uploads
-
06/17/2025 05:35:56 PM
rwxrwxrwx
📄
usage.html
38.19 KB
12/13/2024 09:43:08 AM
rw-r--r--
📄
userActivity.php
13.61 KB
05/19/2025 10:07:22 AM
rw-r--r--
📁
vendor
-
05/19/2025 10:07:19 AM
rwxrwxr-x
📄
verify.php
744 bytes
05/19/2025 10:07:13 AM
rw-rw-r--
📄
version2_landing_page.php
23.08 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
videoAI
-
05/19/2025 10:07:19 AM
rwxr-xr-x
📁
videoAI21-1-25
-
05/19/2025 10:07:22 AM
rwxrwxrwx
📁
videoAII
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📁
videoTest
-
05/19/2025 10:07:17 AM
rwxrwxrwx
📄
videotest.php
13.18 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
videotest1.php
6.36 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
videotesting.php
9.71 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
view.php
13.63 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
view_newsletter.php
1.58 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
websh.php
31 bytes
05/22/2025 07:17:21 AM
rw-r--r--
📁
weeklyEmail
-
06/16/2025 11:41:02 AM
rwxrwxrwx
📁
whatsappBot
-
05/19/2025 10:07:16 AM
rwxrwxrwx
📁
whisper
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📁
xpress_landing_page
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📄
xpress_landing_page.php
78.63 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
xpress_landingpage.html
11.15 KB
01/06/2025 05:55:54 AM
rw-r--r--
📄
zanalytics.php
36.93 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
zgemini.php
15.07 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
zindex.php
61.38 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
znewsletter.php
23.45 KB
05/19/2025 10:07:13 AM
rw-rw-r--
📄
zoomstream.php
73.73 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
zsign-in.php
29.71 KB
05/19/2025 10:07:13 AM
rw-r--r--
📁
zvideoAI
-
05/19/2025 10:07:15 AM
rwxr-xr-x
📁
zzXpress
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
zzcreate.php
35.33 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
zznewsletter.php
23.36 KB
05/19/2025 10:07:19 AM
rw-r--r--
Editing: stream.php
Close
<?php // Database connection require_once './assets/php/db_connect.php'; require_once './assets/php/config.php'; require_once './assets/php/db_config.php'; require_once './assets/php/validate.logged.php'; require_once './assets/php/function.php'; // Handle the AJAX request for data // if (isset($_GET['page'])) { // $page = (int)$_GET['page']; // Get page number // $size = (int)$_GET['size']; // Get number of items per page // $offset = ($page - 1) * $size; // // Query to get the latest records, ordered by postedOn or ID in descending order // // $sql = "SELECT * FROM reader_stream WHERE deleteFlag = 0 AND referenceId IS NULL ORDER BY postedOn DESC LIMIT $size OFFSET $offset"; // $sql = " // SELECT rs.* // FROM reader.reader_stream rs // WHERE (rs.visibility = 'public' // OR rs.userId IN ( // SELECT following_id FROM reader_stream_follow WHERE follower_id = $gUserId // UNION SELECT $gUserId // ) // ) // AND rs.deleteFlag = 0 // AND rs.referenceId IS NULL // AND rs.id NOT IN (SELECT streamId FROM report_stream WHERE userId = $gUserId) // AND rs.userId NOT IN (SELECT blockedUserId FROM cream.block_acc WHERE userId = $gUserId) // AND rs.userId NOT IN (SELECT userId FROM cream.block_acc WHERE blockedUserId = $gUserId) // ORDER BY rs.postedOn DESC // LIMIT $size OFFSET $offset"; // $result = $readerdb->query($sql); // // Initialize the data container // $htmlOutput = ''; // if ($result->num_rows > 0) { // while ($row = $result->fetch_assoc()) { // $htmlOutput .= captureStream($row['id'], $row['userId'], $row['chat'], $row['postedOn'], $row['editedOn'], $row['mediaPath'], $row['metadata']); // } // } // // Check if the current batch is the last one (i.e., less than the requested size) // $last = (count(explode('</div>', $htmlOutput)) - 1 < $size) ? true : false; // // Return the HTML and the last page status as JSON response // echo json_encode(['html' => $htmlOutput, 'last' => $last]); // // Close connection // $readerdb->close(); // exit; // } if (isset($_GET['page'])) { $page = (int)$_GET['page']; // Get page number $size = (int)$_GET['size']; // Get number of items per page $offset = ($page - 1) * $size; $sql = " SELECT rs.* FROM reader.reader_stream rs WHERE (rs.visibility = 'public' OR rs.userId IN ( SELECT following_id FROM reader_stream_follow WHERE follower_id = $gUserId UNION SELECT $gUserId ) ) AND rs.deleteFlag = 0 AND rs.referenceId IS NULL AND rs.id NOT IN (SELECT streamId FROM report_stream WHERE userId = $gUserId) AND rs.userId NOT IN (SELECT blockedUserId FROM cream.block_acc WHERE userId = $gUserId) AND rs.userId NOT IN (SELECT userId FROM cream.block_acc WHERE blockedUserId = $gUserId) ORDER BY rs.postedOn DESC LIMIT $size OFFSET $offset"; $result = $readerdb->query($sql); // Initialize the data container $htmlOutput = ''; $cardCount = 0; // Fetch news articles once $newsArticles = fetchNewsArticles(); $totalNewsArticles = count($newsArticles); $newsSliderCount = 0; // Define advertisement positions (randomly) $adPositions = generateRandomAdPositions($size); // Fetch ad images $adImages = fetchAdImages(); $totalAdImages = count($adImages); $adCount = 0; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { // Add regular stream card $htmlOutput .= captureStream($row['id'], $row['userId'], $row['chat'], $row['postedOn'], $row['editedOn'], $row['mediaPath'], $row['metadata']); $cardCount++; // Check if we need to display an ad at this position if (in_array($cardCount, $adPositions) && $totalAdImages > 0) { $adIndex = $adCount % $totalAdImages; $htmlOutput .= generateAdCard($adImages[$adIndex]); $adCount++; } // After every 5 cards, add a news card slider section if ($cardCount % 5 === 0) { // Calculate which set of news articles to show $newsStartIndex = ($newsSliderCount * 5) % $totalNewsArticles; $currentNewsArticles = array_slice($newsArticles, $newsStartIndex, 5); // If we don't have 5 news articles left, wrap around to the beginning if (count($currentNewsArticles) < 5 && $totalNewsArticles >= 5) { $remaining = 5 - count($currentNewsArticles); $currentNewsArticles = array_merge($currentNewsArticles, array_slice($newsArticles, 0, $remaining)); } $htmlOutput .= generateNewsCardSlider($currentNewsArticles); $newsSliderCount++; } } } // Check if the current batch is the last one $last = (count(explode('</div>', $htmlOutput)) - 1 < $size) ? true : false; // Return the HTML and the last page status as JSON response echo json_encode(['html' => $htmlOutput, 'last' => $last]); // Close connection $readerdb->close(); exit; } function postPin($id) { global $gUserId, $readerdb; $sql = " SELECT rs.* FROM reader.reader_stream rs WHERE (rs.visibility = 'public' OR rs.userId IN ( SELECT following_id FROM reader_stream_follow WHERE follower_id = $gUserId UNION SELECT $gUserId ) ) AND rs.deleteFlag = 0 AND rs.referenceId IS NULL AND rs.id NOT IN (SELECT streamId FROM report_stream WHERE userId = $gUserId) AND rs.userId NOT IN (SELECT blockedUserId FROM cream.block_acc WHERE userId = $gUserId) AND rs.userId NOT IN (SELECT userId FROM cream.block_acc WHERE blockedUserId = $gUserId) AND id = $id "; $result = $readerdb->query($sql); $htmlOutput = ''; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $htmlOutput .= captureStream($row['id'], $row['userId'], $row['chat'], $row['postedOn'], $row['editedOn'], $row['mediaPath'], $row['metadata']); } } // Close connection $readerdb->close(); echo $htmlOutput; exit; } /** * Generate random positions for ad placements * @param int $maxPosition Maximum position to consider * @return array Array of positions where ads should appear */ function generateRandomAdPositions($maxPosition) { $positions = []; // Start with fixed positions like 3, 7, 12 $positions = [3, 7, 12]; // Add more random positions if needed $additionalPositions = 2; // Number of additional random ads for ($i = 0; $i < $additionalPositions; $i++) { $pos = mt_rand(15, $maxPosition); // Ensure we don't have duplicate positions while (in_array($pos, $positions) || $pos % 5 === 0) { // Avoid positions where news sliders appear $pos = mt_rand(15, $maxPosition); } $positions[] = $pos; } sort($positions); return $positions; } /** * Fetch advertisement images * @return array Array of ad image URLs and links */ function fetchAdImages() { // In a real application, you would fetch these from a database or API // This is just a placeholder example return [ [ 'image' => 'assets/img/adv2.png', 'link' => 'https://knoblycream.com/promo/1' ], [ 'image' => 'assets/img/adv1.png', 'link' => 'https://knoblycream.com/promo/2' ], [ 'image' => 'assets/img/adv2.png', 'link' => 'https://knoblycream.com/promo/3' ], [ 'image' => 'assets/img/adv1.png', 'link' => 'https://knoblycream.com/promo/4' ], [ 'image' => 'assets/img/adv2.png', 'link' => 'https://knoblycream.com/promo/5' ] ]; } /** * Generate an ad card * @param array $adData Ad image and link data * @return string HTML for the ad card */ function generateAdCard($adData) { $adId = 'ad-' . uniqid(); $html = '<div class="ads-card" id="' . $adId . '">'; $html .= '<a target="_blank" class="ads-card-link">'; $html .= '<img src="' . $adData['image'] . '" alt="Advertisement" class="ads-card-image">'; $html .= '</a>'; $html .= '</div>'; return $html; } /** * Fetch news articles from the API * @return array News articles data */ function fetchNewsArticles() { $apiUrl = 'https://knoblycream.com/api/articles.php?rss_id=9'; $jsonResponse = file_get_contents($apiUrl); if ($jsonResponse === false) { return []; // Return empty array if API call fails } $newsData = json_decode($jsonResponse, true); return $newsData ?: []; // Return parsed data or empty array if decode fails } /** * Generate a horizontal news card slider * @param array $newsItems Array of news articles * @return string HTML for the news card slider */ // function generateNewsCardSlider($newsItems) // { // if (empty($newsItems)) { // return ''; // Return empty string if no news items // } // // Create unique ID for this news slider instance // $sliderId = 'news-slider-' . uniqid(); // // Create the news slider container // $html = '<div class="newStream news-slider-container" id="' . $sliderId . '">'; // $html .= '<h3 class="newStream-title">Latest News</h3>'; // $html .= '<div class="news-slider-scroll">'; // // Add each news card // foreach ($newsItems as $item) { // $html .= '<div class="news-card" data-id="' . $item['id'] . '">'; // $html .= '<a href="' . $item['url'] . '" target="_blank" class="news-card-link">'; // $html .= '<div class="news-card-image"><img src="' . $item['image'] . '" alt="' . htmlspecialchars($item['title']) . '"></div>'; // $html .= '<div class="news-card-title">' . htmlspecialchars($item['title']) . '</div>'; // $html .= '<div class="news-card-description">' . htmlspecialchars(substr($item['description'], 0, 100)) . '...</div>'; // $html .= '</a>'; // $html .= '</div>'; // } // $html .= '</div>'; // $html .= '</div>'; // return $html; // } /** * Generate a horizontal news card slider * @param array $newsItems Array of news articles * @return string HTML for the news card slider */ function generateNewsCardSlider($newsItems) { if (empty($newsItems)) { return ''; // Return empty string if no news items } // Create unique ID for this news slider instance $sliderId = 'news-slider-' . uniqid(); // Create the news slider container $html = '<div class="newStream news-slider-container" id="' . $sliderId . '">'; $html .= '<h3 class="newStream-title">Latest News</h3>'; $html .= '<div class="news-slider-scroll">'; // Add each news card foreach ($newsItems as $item) { $html .= '<div class="news-card" data-id="' . $item['id'] . '">'; // $html .= '<a href="' . $item['url'] . '" target="_blank" class="news-card-link">'; $html .= '<a href="dashboard.php" target="_blank" class="news-card-link">'; $html .= '<div class="news-card-image"><img src="' . $item['image'] . '" alt="' . htmlspecialchars($item['title']) . '"></div>'; $html .= '<div class="news-card-title">' . htmlspecialchars($item['title']) . '</div>'; $html .= '<div class="news-card-description">' . htmlspecialchars(substr($item['description'], 0, 100)) . '...</div>'; $html .= '</a>'; // Add dashboard button $html .= '<div class="news-card-action">'; $html .= '<a href="dashboard.php" class="dashboard-btn">Go to Reader</a>'; $html .= '</div>'; $html .= '</div>'; } $html .= '</div>'; $html .= '</div>'; return $html; } function get_ip_loc() { $ip = getenv('HTTP_CLIENT_IP') ?: getenv('HTTP_X_FORWARDED_FOR') ?: getenv('HTTP_X_FORWARDED') ?: getenv('HTTP_FORWARDED_FOR') ?: getenv('HTTP_FORWARDED') ?: getenv('REMOTE_ADDR'); $response = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip)); if ($response === false) { $visitCity = ''; $visitCountry = ''; } else { $visitCity = $response['geoplugin_city']; $visitCountry = $response['geoplugin_countryName']; } return array( "ip" => $ip, "city" => $visitCity, "country" => $visitCountry ); } if (isset($_POST['streamId'])) { $iploc = get_ip_loc(); // SQL query using INSERT WHERE NOT EXISTS to prevent duplicate insertion $sql = "INSERT INTO stream_analytics (streamId, userId, ip, city, country) SELECT ?, ?, ?, ?, ? FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM stream_analytics WHERE streamId = ? AND userId = ? )"; // Prepare the statement $stmt = $readerdb->prepare($sql); // Bind the parameters $stmt->bind_param("iisssii", $_POST['streamId'], $gUserId, $iploc['ip'], $iploc['city'], $iploc['country'], $_POST['streamId'], $gUserId); // Execute the query $result = $stmt->execute(); if ($result) { // Check if the insertion was successful if ($stmt->affected_rows > 0) { echo json_encode(['status' => "success", "message" => "Data inserted successfully"]); } else { echo json_encode(['status' => "success", "message" => "Combination of streamId and userId already exists."]); } } else { echo json_encode(['status' => "error", "message" => $stmt->error]); } exit; } function check_cream_subscription($userId) { global $creamdb; $sql = "SELECT plan, plan_type FROM cream_subscription WHERE userId = ? AND NOW() BETWEEN start_date AND end_date"; if ($stmt = $creamdb->prepare($sql)) { $stmt->bind_param("i", $userId); if ($stmt->execute()) { $result = $stmt->get_result(); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); if ($row['plan'] = ! 'Pro') { echo "<script type='text/javascript'> alert('Your plan has ended, Please login!') window.location.href = 'logout.php'; </script>"; } } else { echo "<script type='text/javascript'> alert('Your plan has ended, Please login!') window.location.href = 'logout.php'; </script>"; } } } } // Function to check if the user exists in the session_log and add session if it doesn't exist function checkAndAddUserSession($userId, $creamdb) { $sessionId = session_id(); // SQL query to check if the user has an active session in the session_log table $session_sql = "SELECT COUNT(*) AS session_count FROM session_log WHERE userId = ? AND sessionId = ? AND endTime IS NULL AND startTime >= CURDATE() - INTERVAL 30 DAY"; try { // Prepare the query $stmt = $creamdb->prepare($session_sql); $stmt->bind_param('is', $userId, $sessionId); // Bind the userId parameter to the query $stmt->execute(); // Get the result $result = $stmt->get_result(); $row = $result->fetch_assoc(); // If session_count is 0, the user does not have an active session if ($row['session_count'] == 0) { // Insert a new session entry if the session does not exist createNewSession($userId, $creamdb); } } catch (mysqli_sql_exception $e) { echo "Error checking session: " . $e->getMessage(); } } // Function to create a new session log for the user function createNewSession($userId, $creamdb) { // Get the current session ID $sessionId = session_id(); // Assuming the session ID is already started (session_start() is called earlier) // Insert the new session into the session_log table $insert_sql = "INSERT INTO session_log (userId, sessionId, startTime) VALUES (?, ?, NOW())"; try { // Prepare the query $stmt = $creamdb->prepare($insert_sql); $stmt->bind_param('is', $userId, $sessionId); // Bind userId and sessionId $stmt->execute(); } catch (mysqli_sql_exception $e) { echo "Error inserting new session: " . $e->getMessage(); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Knobly Cream</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.0/font/bootstrap-icons.min.css" rel="stylesheet"> <link rel="stylesheet" href="assets/css/styles.css"> <link rel="stylesheet" href="assets/css/stream.css"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> <!-- Bootstrap 5 CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet"> <!-- Bootstrap 5 Bundle JS (includes Popper) --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script> <style> body { display: flex; flex-direction: column; min-height: 100vh; background-color: #f4f4f4; justify-content: flex-start !important; } .readMoreBtn { color: #6d6e71 !important; background: none; border: none; padding: 0; cursor: pointer; color: blue !important; font-size: x-small !important; display: inline !important; } .readMoreBtn:hover { text-decoration: underline; } .hyperlink img { border-radius: 10px; /* margin-top: 10px; */ max-width: 100%; margin-bottom: 10px; } .linkDisplay .hyperlink img { object-fit: cover; border-radius: 5px; } @media screen and (max-width:720px) { .linkDisplay .hyperlink img { object-fit: cover; border-radius: 5px; width: 100vw; } } .ytprew { display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 20px auto; /* padding: 10px; */ border: 0.2px solid #ccc; border-radius: 8px; background-color: #f9f9f9; width: auto; /* Ensures the div doesn't stretch too wide */ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } .ytprew iframe { width: 100%; max-width: 853px; /* Matches YouTube's default embed width */ height: 256px !important; border-radius: 8px; border: none; } .ytprew a { margin-top: 10px; color: #0073e6; text-decoration: none; font-weight: bold; } .ytprew a:hover { text-decoration: underline; color: #005bb5; } .ytprew p { margin: 10px 0 0; font-size: 14px; color: #555; text-align: center; } #ytPreview { display: none; } .postEditDelete { display: flex; flex-direction: column; gap: 20px; width: fit-content !important; } @media screen and (max-width:884px) { .navaigation_main { display: none; } } </style> <style> #modalContent img { display: block; margin: 0 auto; } #modalContent video { display: block; margin: 0 auto; } </style> <style> /* Slider container */ .slider-container { position: relative; width: 100%; max-width: 600px; /* Adjust width as needed */ margin: 0 auto; /* Center the slider */ overflow: hidden; } /* The actual slider slides */ .slider-slides { display: flex; transition: transform 0.3s ease; } /* Each slide (media item) */ .slider-slides img, .slider-slides video { width: 100%; object-fit: contain; /* Ensure images/videos scale correctly */ } /* Navigation buttons */ .prev, .next { position: absolute; top: 50%; z-index: 10; font-size: 18px; color: white; background-color: rgba(0, 0, 0, 0.5); border: none; padding: 16px; cursor: pointer; transform: translateY(-50%); } .prev { left: 0; } .next { right: 0; } /* Hover effect on the navigation buttons */ .prev:hover, .next:hover { background-color: rgba(0, 0, 0, 0.8); } /* Style for the loading spinner */ .loading-spinner { z-index: 100; display: inline-block; position: fixed; bottom: 50px; width: 50px; height: 50px; text-align: center; font-size: 18px; color: #db5919; font-weight: bold; } .loading-spinner::after { content: ""; position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin-top: -20px; margin-left: -20px; border: 5px solid #ccc; border-top: 5px solid #3498db; border-radius: 50%; animation: spin 1s linear infinite; } /* Animation for the spinning effect */ @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .mediawithvisibility { display: flex; justify-content: center; gap: 4px; } .model { width: 700px !important; } </style> <style> /* Media container */ .media-container { display: grid; grid-template-columns: repeat(2, 1fr); /* Default 3 columns */ gap: 10px; width: 100%; } /* Stream media styling */ .stream-media { position: relative; } .stream-media img, .stream-media video { width: 100%; height: 100%; object-fit: cover; object-position: center; } /* Specific styles for more block */ .stream-media.more { display: flex; justify-content: center; align-items: center; background-color: #f0f0f0; border: 1px solid #ddd; color: #777; font-size: 16px; } .stream-media.more .more-count { font-weight: bold; } /* Custom grid layouts based on the number of items */ <?php if ($mediaCount == 2) { ?>.media-container { grid-template-columns: repeat(2, 1fr); /* 2 items in half-half layout */ } <?php } elseif ($mediaCount == 3) { ?>.media-container { grid-template-columns: 1fr 2fr; /* 1:2 ratio layout */ } <?php } elseif ($mediaCount == 4) { ?>.media-container { grid-template-columns: repeat(4, 1fr); /* 4 items in 1/4 layout */ } <?php } elseif ($mediaCount == 1) { ?>.media-container { grid-template-columns: 1fr; /* Single item takes full width */ } <?php } ?> </style> <style> .form-group { margin-bottom: 20px; font-family: Arial, sans-serif; } .form-group label { font-size: 14px; font-weight: 300; color: #333; margin-bottom: 4px; display: block; } .form-control { width: 100%; padding: 4px 10px; border-radius: 4px; border: 1px solid #ccc; font-size: 14px; background-color: #f9f9f9; transition: border-color 0.3s ease; } .form-control:focus { outline: none; border-color: #db5919; box-shadow: none; } .form-control option { padding: 8px; font-size: 14px; background-color: #fff; color: #333; } </style> <style> /* Dropdown container */ .dropdown { position: relative; display: inline-block; padding: 0px 20px !important; } /* Button styling */ .btn-primary { background-color: #007bff; color: white; border: none; padding: 10px 15px; font-size: 16px; cursor: pointer; border-radius: 5px; transition: background 0.3s ease-in-out; } .btn-primary:hover { background-color: #0056b3; } /* Dropdown content */ #channelList_<?= $id ?> { display: none; position: absolute; background-color: white; min-width: 200px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); border-radius: 5px; margin-top: 5px; z-index: 1000; overflow: hidden; } #channelList_<?= $id ?>.show { display: block; } /* Dropdown items */ #channelList_<?= $id ?>a { color: black; padding: 10px 15px; text-decoration: none; display: block; transition: background 0.3s ease-in-out; } #channelList_<?= $id ?>a:hover { background-color: #f1f1f1; } .add-channels-btn { background-color: #db5919 !important; border-radius: 4px !important; } </style> <style> .bookmarkNotification { width: max-content; position: fixed; z-index: 10000; top: 15%; left: 47%; color: white; background: #333; padding: 10px 20px; border-radius: 5px; opacity: 0; transition: opacity 0.3s ease; } .bookmarkNotification.show { opacity: 1; } @media screen and (max-width:750px) { .bookmarkNotification { left: 35%; } } @media screen and (max-width:540px) { .channel-item { margin-bottom: 10px !important; padding: 10px 0px !important; } .dropdown { position: relative; display: inline-block; padding: 4px 0px !important; } } .socialMainCont { height: 0vh; /* position: fixed; */ margin-top: 80px; } </style> <style> /* News Slider Styles - with newStream class to avoid conflicts */ .newStream.news-slider-container { width: 100%; margin: 25px 0; position: relative; overflow: hidden; background: #f9f9f9; border-radius: 12px; padding: 20px 0 15px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); } .newStream-title { padding: 0 20px 15px; margin: 0; font-size: 18px; font-weight: 600; color: #333; } .newStream .news-slider-scroll { display: flex; overflow-x: auto; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */ scrollbar-width: none; /* Firefox */ padding: 0 20px 15px; gap: 15px; cursor: grab; /* Show grab cursor to indicate scrollability */ user-select: none; /* Prevent text selection during drag */ } .newStream .news-slider-scroll::-webkit-scrollbar { display: none; /* Chrome, Safari, Opera */ } .newStream .news-slider-scroll:active { cursor: grabbing; /* Change cursor when actively dragging */ } .newStream .news-card { min-width: 280px; max-width: 280px; flex: 0 0 auto; background: white; border-radius: 8px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease; } .newStream .news-card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); } .newStream .news-card-link { text-decoration: none; color: inherit; display: block; outline: none; } .newStream .news-card-image { height: 160px; overflow: hidden; } .newStream .news-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; } .newStream .news-card:hover .news-card-image img { transform: scale(1.05); } .newStream .news-card-title { padding: 12px 15px 8px; font-weight: 600; font-size: 16px; line-height: 1.3; color: #222; } .newStream .news-card-description { padding: 0 15px 15px; font-size: 14px; color: #666; line-height: 1.4; } /* Add fade effect to indicate more content */ .newStream .news-slider-scroll::after { content: ''; position: absolute; right: 0; top: 0; height: 100%; width: 30px; background: linear-gradient(to right, rgba(249, 249, 249, 0), rgba(249, 249, 249, 1)); pointer-events: none; /* Allow clicking through the fade */ } /* Add responsive adjustments */ @media (max-width: 768px) { .newStream .news-card { min-width: 250px; } .newStream .news-card-image { height: 140px; } } .news-card-action { margin-top: 10px; text-align: left; padding: 0 10px 10px; bottom: 0; } .dashboard-btn { display: inline-block; padding: 8px 15px; background-color: #db5919; color: white; text-decoration: none; border-radius: 4px; font-weight: bold; transition: background-color 0.3s; } .dashboard-btn:hover { background-color: #db5919; } @media (max-width: 480px) { .newStream .news-card { min-width: 220px; } .newStream .news-card-image { height: 130px; } } </style> <style> /* Ad Card Styles */ .ads-card { width: 100%; margin: 15px 0; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); background-color: #fff; position: relative; } .ads-card:before { content: "Ad"; position: absolute; top: 5px; right: 5px; background-color: rgba(0, 0, 0, 0.5); color: #fff; font-size: 10px; padding: 2px 5px; border-radius: 3px; z-index: 10; } .ads-card-link { display: block; text-decoration: none; color: inherit; } .ads-card-image { width: 100%; height: auto; display: block; transition: transform 0.3s ease; } .ads-card:hover .ads-card-image { transform: scale(1.03); } /* Make sure ads are responsive */ @media (max-width: 768px) { .ads-card { margin: 10px 0; } } </style> <!-- dont touch touch this this is app code --> <script> document.addEventListener("DOMContentLoaded", function() { setTimeout(() => { const cookies = document.cookie; console.log("Storing cookies after login:", cookies); localStorage.setItem("session_cookie", cookies); }, 2000); }); </script> <script> document.addEventListener('DOMContentLoaded', function() { // Initialize all news sliders on the page initializeNewsSliders(); }); // This function will need to be called again when you load more content via AJAX function initializeNewsSliders() { const sliders = document.querySelectorAll('.news-slider-container'); sliders.forEach(slider => { const scrollContainer = slider.querySelector('.news-slider-scroll'); // Skip if already initialized if (slider.dataset.initialized === 'true') { return; } if (scrollContainer) { // Enable smooth scrolling behavior scrollContainer.style.scrollBehavior = 'smooth'; // Add drag-to-scroll functionality let isDown = false; let startX; let scrollLeft; scrollContainer.addEventListener('mousedown', (e) => { isDown = true; scrollContainer.style.cursor = 'grabbing'; startX = e.pageX - scrollContainer.offsetLeft; scrollLeft = scrollContainer.scrollLeft; e.preventDefault(); }); scrollContainer.addEventListener('mouseleave', () => { isDown = false; scrollContainer.style.cursor = 'grab'; }); scrollContainer.addEventListener('mouseup', () => { isDown = false; scrollContainer.style.cursor = 'grab'; }); scrollContainer.addEventListener('mousemove', (e) => { if (!isDown) return; const x = e.pageX - scrollContainer.offsetLeft; const walk = (x - startX) * 2; // Scroll speed multiplier scrollContainer.scrollLeft = scrollLeft - walk; }); // Add touch events for mobile scrollContainer.addEventListener('touchstart', (e) => { startX = e.touches[0].pageX - scrollContainer.offsetLeft; scrollLeft = scrollContainer.scrollLeft; }, { passive: true }); scrollContainer.addEventListener('touchmove', (e) => { if (!startX) return; const x = e.touches[0].pageX - scrollContainer.offsetLeft; const walk = (startX - x) * 1.5; // Scroll speed multiplier scrollContainer.scrollLeft = scrollLeft + walk; }, { passive: true }); scrollContainer.addEventListener('touchend', () => { startX = null; }); // Mark as initialized slider.dataset.initialized = 'true'; // Set initial cursor style scrollContainer.style.cursor = 'grab'; } }); } // Make the function globally available so it can be called after AJAX content loads window.initializeNewsSliders = initializeNewsSliders; </script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <!-- Bootstrap JS and Bootstrap Icons --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <script src="assets/js/stream.js"></script> <script> const userId = <?= $gUserId ?>; let tempUrl = ''; let letUrl = true; let dotInterval; var myModal; let page = 1; // Start with the first page const pageSize = 20; // Number of items per page let isLoading = false; // Flag to prevent multiple AJAX calls at once let isLastPage = false; // Flag to check if the last page is reached function shareNow(postId) { // console.log(postId); var link = "https://knoblycream.com/streamPush.php?id=" + postId; copyToClipboard(link); } function copyToClipboard(note) { // Append the custom text to the note var textToCopy = note; // Try using the Clipboard API first if (navigator.clipboard) { navigator.clipboard.writeText(textToCopy).then(function() { alert('Note copied to clipboard: ' + textToCopy); }).catch(function(error) { console.error('Clipboard API error: ', error); fallbackCopy(textToCopy); }); } else { console.error('Clipboard API is not available'); fallbackCopy(textToCopy); } // Fallback method using a temporary textarea element function fallbackCopy(textToCopy) { // Create a temporary textarea element using jQuery var $tempTextArea = $('<textarea>'); // Set the value of the textarea to the text we want to copy $tempTextArea.val(textToCopy).appendTo('body'); // Focus the textarea and select the content using jQuery $tempTextArea.focus().select(); $tempTextArea[0].setSelectionRange(0, textToCopy.length); // For mobile devices // Try executing the copy command try { var successful = document.execCommand('copy'); if (successful) { alert('Note copied to clipboard: ' + textToCopy); } else { alert('Failed to copy note.'); } } catch (err) { console.error('Error copying text: ', err); alert('Failed to copy note.'); } finally { // Remove the temporary textarea from the document $tempTextArea.remove(); } } } $(document).on('click', '.shareNow', function() { shareNow($(this).data('id')); }); function removeMeta() { $('#linkPreview').hide(); $('#hiddenTitle').val(''); $('#hiddenDesc').val(''); $('#hiddenUrl').val(''); $('#hiddenDomain').val(''); $('#hiddenImage').val(''); } function removeYT() { $('ytPreview').html(''); $('#ytPreview').hide(); } // The uploadPost function can now use myModal because it's in a broader scope function uploadPost(schedule = false) { var content = $("#contentTextarea").val(); var fileInput = $("#fileInput")[0].files; var hiddenTitle = $("#hiddenTitle").val(); var hiddenDesc = $("#hiddenDesc").val(); var hiddenUrl = $("#hiddenUrl").val(); var hiddenImage = $("#hiddenImage").val(); var hiddenDomain = $("#hiddenDomain").val(); var hiddenYTLink = $("#hiddenYTLink").val(); var visibility = $("#visibilitySelect").val(); var scheduleDate = $("#scheduleDate").val(); // Always get value var formData = new FormData(); if (content) formData.append("content", content); if (fileInput.length > 0) { for (var i = 0; i < fileInput.length; i++) { formData.append("media[]", fileInput[i]); } } if (hiddenTitle) formData.append("hiddenTitle", hiddenTitle); if (hiddenDesc) formData.append("hiddenDesc", hiddenDesc); if (hiddenUrl) formData.append("hiddenUrl", hiddenUrl); if (hiddenImage) formData.append("hiddenImage", hiddenImage); if (hiddenDomain) formData.append("hiddenDomain", hiddenDomain); if (hiddenYTLink) formData.append("hiddenYTLink", hiddenYTLink); if (visibility) formData.append("visibility", visibility); // ✅ Scheduling logic if (schedule && scheduleDate) { formData.append("deleteFlag", "1"); // Use deleteFlag as scheduler indicator formData.append("scheduleDate", scheduleDate); } else { formData.append("deleteFlag", "0"); // Regular post } $("#loadingIcon").show(); // Read the schedule date value var scheduleDateValue = $('#scheduleDate').val(); var schedule = scheduleDateValue !== null && scheduleDateValue.trim() !== ''; console.log("Schedule date value:", scheduleDateValue); console.log("Is scheduled:", schedule); // This should help debug $.ajax({ url: 'process_data.php', type: 'POST', data: formData, processData: false, contentType: false, success: function(response) { $("#loadingIcon").hide(); if (response.status === 'success') { alert(schedule ? "Post scheduled!" : "Posted successfully!"); myModal.hide(); window.location.reload(); } else { alert("Error: " + response.message); } }, error: function(xhr, status, error) { $("#loadingIcon").hide(); alert("An error occurred: " + error); } }); } // function toggleSchedule() { // const dateInput = document.getElementById("scheduleDate"); // if (dateInput.style.display === "none" || dateInput.style.display === "") { // dateInput.style.display = "block"; // const now = new Date(); // now.setMinutes(now.getMinutes() - now.getTimezoneOffset()); // dateInput.min = now.toISOString().slice(0, 16); // } else { // dateInput.style.display = "none"; // dateInput.value = ""; // } // } function openModal(type, path, count, id) { let str = path; let mediaPaths = str.split(","); event.stopPropagation(); // Prevent event propagation if (type === 'image') { // Convert the array of image paths to a string and encode it const imagePaths = encodeURIComponent(mediaPaths.join(",")); const selectedImage = mediaPaths[count]; // Redirect to a new page with all images and the selected image index window.location.href = 'new-page.php?imagePaths=' + imagePaths + '&selectedImage=' + encodeURIComponent(selectedImage) + '&postId=' + id; } if (type === 'video') { const videoSrc = mediaPaths[count]; // Redirect to a new page with the selected video window.location.href = 'new-page.php?videoPath=' + encodeURIComponent(videoSrc) + '&postId=' + id; } } function generateVideoThumbnail($ele) { try { // Fetch the video URL from the source element inside the .post div var videoUrl = $ele.find('video source').attr('src'); if (!videoUrl) { return false; // If no video URL, return false early } var $video = $('<video>').attr('controls', true).css({ maxWidth: '100%', maxHeight: '70vh' // Set max height for the preview }); // Create a hidden video element to extract the first frame var videoElement = document.createElement('video'); videoElement.src = videoUrl; // Create a canvas to draw the first frame var $thumbnailCanvas = $('<canvas>')[0]; var thumbnailContext = $thumbnailCanvas.getContext('2d'); // Wait for the video to load and then set it to the first frame $(videoElement).on('loadeddata', function() { videoElement.currentTime = 0; // Set video to the first frame }); // Once the video seeks to the first frame, capture the thumbnail $(videoElement).on('seeked', function() { // Set canvas size to match video dimensions $thumbnailCanvas.width = videoElement.videoWidth; $thumbnailCanvas.height = videoElement.videoHeight; // Draw the current frame (first frame) onto the canvas thumbnailContext.drawImage(videoElement, 0, 0, videoElement.videoWidth, videoElement.videoHeight); // Convert the canvas to a data URL and set it as the video poster var dataUrl = $thumbnailCanvas.toDataURL(); $video.attr('poster', dataUrl); // Set the first frame as the thumbnail }); // Keep the existing content of the div intact var existingVideo = $ele.find('video'); // Replace the video inside the .post div with the new one that has a thumbnail existingVideo.replaceWith($video); // Set the video source and load it $video.attr('src', videoUrl); $video[0].load(); // $video[0].play(); // Optionally, you can play the video if needed return true; // Return true if the function completes successfully } catch (error) { console.error("Error generating video thumbnail:", error); return false; // Return false if an error occurs } } function handleLazyLoad() { $('.post-content').each(function() { if ($(this).data('thumbnail') === false && $(this).find('video').length > 0) { generateVideoThumbnail($(this)); $(this).data('thumbnail', true); } }); } function isElementInView($el) { var windowTop = $(window).scrollTop(); var windowBottom = windowTop + $(window).height(); var elementTop = $el.offset().top; var elementBottom = elementTop + $el.height(); // Check if element is in the viewport return elementBottom >= windowTop && elementTop <= windowBottom; } function storeAnalytics($streamId) { $.ajax({ url: '', // The same file since we handle both front-end and back-end here type: 'POST', data: { streamId: $streamId }, success: function(response) { const data = JSON.parse(response); if (data.status == "error") { alert('Please Check the Internet Connection.'); } }, error: function() { alert('Please Check the Internet Connection.'); } }); } function streamAnalytics() { $('.post').each(function() { var $ele = $(this); // Current .post element if (isElementInView($ele) && !$ele.hasClass('logged')) { storeAnalytics($ele.attr('data-id')); $ele.addClass('logged'); // Mark it as logged } }); } // Function to play or pause the video based on its visibility function handleVideoVisibility(videoElement, $postElement) { if (isElementInView($postElement)) { // Video is in the viewport, play it if it's not already playing // if (videoElement.paused) { // videoElement.play().catch(function(error) {}); // } } else { // Video is out of the viewport, pause it if it's playing if (!videoElement.paused) { videoElement.pause(); } } } // Function to check all videos within .post elements function checkVideoVisibility() { $('.post').each(function() { var video = $(this).find('video')[0]; // Get the video element if (video) { handleVideoVisibility(video, $(this)); // Call the function to handle play/pause } }); } // Function to load data from the server function loadData() { if (isLoading || isLastPage) return; // If data is already being loaded or the last page is reached, return early isLoading = true; // Set flag to true to prevent further calls $('.loading-spinner').show(); // Show the loading indicator $.ajax({ url: '', // The same file since we handle both front-end and back-end here type: 'GET', data: { page: page, size: pageSize }, success: function(response) { const data = JSON.parse(response); const html = data.html; if (html.length > 0) { // Append the HTML content directly to the container (this loads latest data below) // $('#data-container').append(html); $('.first_right_container').append(html); // Check if the last page is reached isLastPage = data.last; page++; // Increment the page number for the next request } $('.loading-spinner').hide(); // Hide the loading indicator isLoading = false; // Reset the flag after data is loaded }, error: function() { $('.loading-spinner').hide(); isLoading = false; // Reset the flag in case of error alert('Error loading data'); } }); } function blockAccount(userId) { // Ask the user for confirmation before proceeding if (confirm("Are you sure you want to block this account?")) { $.ajax({ url: 'assets/php/blockAccount.php', // The PHP script to handle the blocking method: 'POST', data: { act: 'block', userId: userId }, success: function(response) { // Check if the block operation was successful if (response.status === 'success') { alert("Blocked the account"); window.location.reload(); // Reload the page to reflect the changes } else { alert(response.message); // Show error message if blocking fails } }, error: function() { alert('There was an error while blocking the account.'); } }); } } // Function to handle the report submission with AJAX function report_stream(userId, streamId, reason) { // Prepare the data for the server using FormData const formData = new FormData(); formData.append('userId', userId); formData.append('streamId', streamId); formData.append('reason', reason); // Perform the AJAX request with jQuery $.ajax({ url: '/assets/php/report_stream.php', type: 'POST', data: formData, dataType: 'json', processData: false, contentType: false, success: function(data) { console.log(data); if (data.status === 'success') { alert(data.message); window.location.reload(); // Reload the page after successful submission } else { alert('Error: ' + data.message); } }, error: function(xhr, status, error) { console.error('Error:', error); alert('An error occurred while trying to report the post. Please try again later.'); } }); } document.addEventListener("DOMContentLoaded", function() { const uploadModalEl = document.getElementById("uploadModal"); const reportModalEl = document.getElementById("reportModal"); if (uploadModalEl) { window.myModal = new bootstrap.Modal(uploadModalEl); } if (reportModalEl) { window.reportModal = new bootstrap.Modal(reportModalEl); } const plusButton = document.getElementById("plusButton"); if (plusButton && window.myModal) { plusButton.addEventListener("click", function() { window.myModal.show(); }); } }); $(document).ready(function() { // Initialize the height on page load var $textarea = $('#contentTextarea'); if ($textarea.length) { adjustTextareaHeight($textarea[0]); } $(document).on('click', '.followButton', function() { const targetUserId = $(this).data('id'); // ID of the user to follow/unfollow toggleFollow(this, userId, targetUserId); // Pass `this` (the button element) as the first parameter }); $('#saveModalEditButton').on('click', function() { saveEditedContent(); }); $(document).on('click', '.saveButton', function(e) { var id = $(this).data('id'); toggleSave(this, id); }); // likedUsers $(document).on('click', '.likedUsers', function() { const postId = $(this).data('id'); // Get post ID from the button's data attribute $.ajax({ url: 'fetch_liked_users.php', type: 'POST', data: { postId: postId }, success: function(response) { const users = JSON.parse(response); if (users.error) { alert(users.error); } else if (users.message) { $('#likedUsersList').html('<li class="list-group-item text-center">' + users.message + '</li>'); } else { const userList = users.map(user => `<li class="list-group-item">${user}</li>`).join(''); $('#likedUsersList').html(userList); } const likedUsersModal = new bootstrap.Modal(document.getElementById('likedUsersModal')); likedUsersModal.show(); }, error: function() { alert('Error fetching likes.'); } }); }); // Handle like button clicks $(document).on('click', '.likeButton', function(e) { event.stopPropagation(); // If the clicked element has the `likedUsers` class, do not toggle like/unlike if ($(e.target).hasClass('likedUsers')) { return; // Prevent triggering the like toggle } // Proceed with like toggle functionality var feedId = $(this).data('id'); toggleLike(this, feedId, userId); }); $('#contentTextarea').on('input', function() { var content = $('#contentTextarea').val().trim(); // Updated regular expression to match full URLs, including subdomains and paths // var url_pattern = /(?:https?|ftp):\/\/(?:[a-zA-Z0-9-]+\.)?(?:[a-zA-Z0-9-]+\.[a-zA-Z]{2,})(?:\/[^\s]*)?/g; var url_pattern = /(?:https?|ftp):\/\/(?:[a-zA-Z0-9-]+\.)?(?:[a-zA-Z0-9-]+\.[a-zA-Z]{2,})(?:\/[^\s\)]*)?/g; var youtube_pattern = /(?:v=|youtu\.be\/|embed\/)([a-zA-Z0-9_-]+)/; // Attempt to match all URLs within the content var matchedUrls = content.match(url_pattern); var youtubeUrl = content.match(youtube_pattern); if (youtubeUrl) { youtubeUrl.forEach(function(url) { // console.log('Matched URL:', url); // Log each matched URL }); if (tempUrl != youtubeUrl[0]) { letUrl = true; tempUrl = youtubeUrl[0]; removeMeta(); // Show the loading animation $('#loadingIcon').show(); // $('#postedContent').html(''); // Clear any previous metadata // Send the first matched URL to the server for metadata fetching $.ajax({ url: 'link.php', // Submit to the same page type: 'POST', data: { ytUrl: youtubeUrl[0] }, // Send the first matched URL success: function(response) { // Hide the loading animation $('#loadingIcon').hide(); if (response.iframe) { $('#ytPreview').html(response.iframe); $('#hiddenYTLink').val(response.iframe || ''); $('#hiddenTitle').val(response.title || ''); $('#ytPreview').show(); } else { return; } }, error: function() { // Hide the loading animation on error $('#loadingIcon').hide(); // console.log("Error fetching Youtube Link"); } }); } } else if (matchedUrls) { // Log all matched URLs to the console (for testing purposes) matchedUrls.forEach(function(url) { // console.log('Matched URL:', url); // Log each matched URL }); if (tempUrl != matchedUrls[0]) { letUrl = true; tempUrl = matchedUrls[0]; removeYT(); // Show the loading animation $('#loadingIcon').show(); // $('#postedContent').html(''); // Clear any previous metadata // Send the first matched URL to the server for metadata fetching $.ajax({ url: 'link.php', // Submit to the same page type: 'POST', data: { url: matchedUrls[0] }, // Send the first matched URL success: function(response) { // Hide the loading animation $('#loadingIcon').hide(); $('#linkPreview').show(); if (response.url) { $('#linkPreview #linkHeading').html(response.title || ''); // Set heading text $('#linkPreview #linkDesc').html(response.description || ''); // Set description text $('#linkPreview #linkUrl').attr('href', response.url || ''); // Set link URL $('#linkPreview #linkUrl').html(response.domain || ''); $('#hiddenTitle').val(response.title || ''); $('#hiddenDesc').val(response.description || ''); $('#hiddenUrl').val(response.url || ''); $('#hiddenDomain').val(response.domain || ''); if (response.image) { $('#linkPreview img').attr('src', response.image); // Set image source $('#hiddenImage').val(response.image); } } else { return; } }, error: function() { // Hide the loading animation on error $('#loadingIcon').hide(); // console.log("Error fetching the metadata"); } }); } } else { // Clear content and hide the loading animation if no valid URL is found $('#loadingIcon').hide(); } if (tempUrl != youtubeUrl[0]) { removeYT(); } if (tempUrl != matchedUrls[0]) { removeMeta() } if (youtubeUrl[0] == '') { removeYT(); } if (matchedUrls[0] == '') { removeMeta(); } }); // $(window).on('scroll', checkVideoVisibility); $(window).on('scroll', function() { streamAnalytics(); checkVideoVisibility(); // Check if the user has scrolled near the bottom of the page if ($(window).scrollTop() + $(window).height() >= $(document).height() - 100) { loadData(); // Load more data when scrolled near the bottom } }); $('.post-content').attr('tabindex', '0'); $(document).on('mouseenter', '.post-content', function() { if ($(this).data('thumbnail') === false && $(this).find('video').length > 0) { generateVideoThumbnail($(this)); $(this).data('thumbnail', true); } }); $(document).on('ajaxComplete', function() { handleLazyLoad(); // Also check on page load in case elements are already in view $(window).trigger('scroll'); }); $("#reportReasonSelect").on("change", function() { const otherReasonContainer = $("#otherReasonContainer"); if ($(this).val() === "Others") { otherReasonContainer.show(); } else { otherReasonContainer.hide(); } }); // Initial data load loadData(); }); // Close the dropdown menu if the user clicks anywhere outside the menu or the icon $(document).click(function(event) { var $isClickInsideMenu = $(event.target).closest('.dropcardMenu'); var $isClickInsideIcon = $(event.target).closest('.menu-container'); // Close the dropdown if the click is outside the menu and icon if ($isClickInsideMenu.length === 0 && $isClickInsideIcon.length === 0) { closeAllDropcardMenus(); } }); // Add event listeners to Edit and Delete buttons to close the dropdown when clicked $('.editBtn').click(function() { closeAllDropcardMenus(); }); $('.dropcardMenu a button').click(function() { closeAllDropcardMenus(); }); $(document).on('click', '.reportThisPost', function() { var reportId = $(this).data('id'); reportModal.show(); $('#reportStreamId').val(reportId); }); $(document).on('click', '.blockThisPost', function() { var blockId = $(this).data('userid'); // reportModal.show(); // $('#reportStreamId').val(reportId); blockAccount(blockId); }); // jQuery code to handle the 'Submit' button click $(document).on('click', '#submitReportButton', function() { // Get the selected reason from the dropdown const reason = $('#reportReasonSelect').val(); const streamId = $('#reportStreamId').val(); const otherReason = $('#otherReasonTextarea').val().trim(); // Get the value from the textarea // console.log(reason); // console.log(streamId); // console.log(otherReason); // Ensure a reason is selected if (!reason) { alert('Please select a reason.'); return; } // If "Others" is selected, ensure the textarea is filled let finalReason = reason; if (reason === 'Others') { if (!otherReason) { alert('Please provide a reason.'); return; } finalReason = otherReason; // Use the value from the textarea as the reason } // Call the report_stream function with the selected data report_stream(userId, streamId, finalReason); }); // Attach the `oninput` event for dynamic resizing $(document).on('input', '#contentTextarea', function() { adjustTextareaHeight(this); }); function fetchChannelData(id) { const userId = <?= $gUserId ?>; const postId = id; const channelList = $("#channelList_" + postId); // Close other dropdowns before showing this one $(".channels_list").hide(); // Clear previous entries before making the request channelList.empty(); // Perform AJAX request $.ajax({ url: "handle_channel.php", type: "GET", data: { user_id: userId, post_id: postId }, dataType: "json", success: function(data) { if (data.success) { if (data.channels.length === 0) { channelList.append("<p class='dropdown-item'>No channels available</p>"); } else { $.each(data.channels, function(index, channel) { let listItem = $("<button>") .addClass("channel-item dropdown-item") .attr("data-id", channel.id) .text(channel.name) .on("click", function() { addToChannel(postId, channel.id); }); channelList.append(listItem); }); } // Add "Add Channels" button below the channel list let addButton = $("<button>") .addClass("add-channels-btn dropdown-item") .text("Add Channels") .on("click", function() { // Redirect to add_channel.php window.location.href = "add_channel.php"; // Redirect to the page }); channelList.append(addButton); // Show the dropdown only after data is fetched channelList.show(); } else { alert("Error: " + data.message); } }, error: function(xhr, status, error) { console.error("AJAX Error:", error); } }); } // Hide dropdown when clicking outside $(document).on("click", function(event) { if (!$(event.target).closest(".channels_list").length) { $(".channels_list").hide(); } }); function addToChannel(postId, channelId) { $.ajax({ url: 'add_to_channel.php', type: 'POST', data: { postId: postId, channelId: channelId }, success: function(response) { const result = JSON.parse(response); // Parse the JSON response if (result.success) { alert('Post added to channel'); } else { alert('Failed to add to channel: ' + result.message); } }, error: function(xhr, status, error) { alert('Error: ' + error); } }); } // Select the bookmark icon and notification elements $(document).ready(function() { const notification = document.querySelector('.bookmarkNotification'); // Target elements that have both fa-regular AND fa-thumbs-up classes $('body').on('click', '.fa-regular.fa-bookmark', function(e) { $('.bookmarkNotification').text('Bookmark Added'); notification.classList.add('show'); // Hide it after 2 seconds (2000 milliseconds) setTimeout(() => { notification.classList.remove('show'); }, 1000); }) $('body').on('click', '.fa-solid.fa-bookmark', function(e) { $('.bookmarkNotification').text('Bookmark Removed'); notification.classList.add('show'); // Hide it after 2 seconds (2000 milliseconds) setTimeout(() => { notification.classList.remove('show'); }, 1000); }) }); </script> <script> $(document).ready(function() { // Target elements that have both fa-regular AND fa-thumbs-up classes $('body').on('click', '.fa-regular.fa-thumbs-up', function(e) { // List of emojis to use - only thumbs up const emojis = ['🎉']; // const emojis = ['👍', '❤️', '😊', '🎉', '⭐', '🚀', '💯', '🔥']; // Always create exactly 4 emoji elements const emojiCount = 5; for (let i = 0; i < emojiCount; i++) { // Create an emoji span const emoji = $('<span></span>'); // Use thumbs up emoji emoji.html(emojis[0]); emoji.addClass('flowing-emoji'); // Get button position const buttonOffset = $(this).offset(); const startX = buttonOffset.left + $(this).width() / 2; const startY = buttonOffset.top; // Add some randomness to starting position const randomOffsetX = (Math.random() - 0.5) * 20; // Set emoji styles emoji.css({ 'position': 'absolute', 'left': `${startX + randomOffsetX}px`, 'top': `${startY}px`, 'font-size': `${1.2 + Math.random() * 0.4}rem`, 'z-index': '999999', 'pointer-events': 'none', 'opacity': '1', 'transform': `translate(-50%, 0%) rotate(${(Math.random() - 0.5) * 20}deg)` }); // Append to body $('body').append(emoji); // Calculate random path parameters const endX = startX + (Math.random() - 0.5) * 60; const endY = startY - (120 + Math.random() * 60); const delay = Math.random() * 200; const duration = 1000 + Math.random() * 500; // Animate with a smooth path setTimeout(function() { emoji.animate({ top: `${endY}px`, left: `${endX}px`, opacity: 0 }, { duration: duration, easing: 'easeOutQuad', step: function(now, fx) { if (fx.prop === "top") { const wiggle = Math.sin(now * 0.03) * 3; $(this).css('margin-left', wiggle + 'px'); } }, complete: function() { $(this).remove(); } }); }, delay); } }); // Add CSS styles dynamically if not already there if ($('#emoji-flow-styles').length === 0) { $('head').append(` <style id="emoji-flow-styles"> .flowing-emoji { position: absolute; pointer-events: none; user-select: none; z-index: 9999; transition: transform 0.2s ease-out; } </style> `); } // Make sure jQuery easing is available if (typeof $.easing.easeOutQuad === 'undefined') { $.easing.easeOutQuad = function(x, t, b, c, d) { return -c * (t /= d) * (t - 2) + b; }; } }); </script> <script> window.addEventListener('load', function() { // Get the postId from the URL fragment (e.g., #post_3579) var postIdFromURL = window.location.hash.substring(1); // Get post_3579 var postId = postIdFromURL.replace('post_', ''); // Remove 'post_' to get the actual post ID // Get the stored postId from localStorage var storedPostId = localStorage.getItem('scrollToPost'); // Check if the postId exists and matches if (postId && postId === storedPostId) { // Scroll to the post after it is fully loaded scrollToPost(postId); } // Optionally, remove the postId from localStorage after the scroll action localStorage.removeItem('scrollToPost'); }); function scrollToPost(postId) { // Try to find the element by postId (e.g., post_3579) var postElement = document.getElementById('post_' + postId); if (!postElement) { // If the post is not yet available, wait for it to load setTimeout(function() { scrollToPost(postId); // Check again after 500ms }, 500); } else { // Scroll to the post with smooth behavior postElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); } } </script> </head> <body> <? if ($gUserPlan == 1) check_cream_subscription($gUserId); // checkAndAddUserSession($gUserId, $creamdb); ?> <? include 'assets/php/social_navbar.php' ?> <div class="add_emerge" style="display: flex; flex-direction:column; justify-content:center"> <?php include 'assets/php/event_scrollbar.php'; ?> <div class="container socialMainCont" style="margin-top: 10px; padding:0;"> <!-- Left Section --> <div class="streamLeftbar"> <? include 'assets/php/sidebar.php' ?> </div> <div class="first_right_container"> </div> <div class="loading-spinner"></div> <button id="plusButton" class="btn btn-primary "> <i class="fa fa-plus"></i> </button> </div> </div> <!-- Edit Post Modal --> <div class="modal fade" id="editPostModal" tabindex="-1" aria-labelledby="editPostModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="editPostModalLabel">Edit Post</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <!-- Textarea for editing content --> <textarea id="modalContentTextarea" class="form-control" rows="5" style="overflow-y: auto; max-height: 200px;"></textarea> </div> <div class="modal-footer"> <!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> --> <button type="button" id="saveModalEditButton" class="btn btn-primary">Save changes</button> </div> </div> </div> </div> <!-- Report Modal --> <div class="modal fade" id="reportModal" tabindex="-1" aria-labelledby="reportModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="reportModalLabel">Why are you reporting this post?</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <!-- Dropdown for selecting reasons --> <form id="reportReasonsForm"> <div class="mb-3"> <label for="reportReasonSelect" class="form-label">Select a reason:</label> <select class="form-select" id="reportReasonSelect"> <option value="" selected disabled>Choose a reason</option> <option value="Nudity or sexual activity">Nudity or sexual activity</option> <option value="Bullying or harassment">Bullying or harassment</option> <option value="Suicide, self-injury or eating disorders">Suicide, self-injury or eating disorders</option> <option value="Violence, hate or exploitation">Violence, hate or exploitation</option> <option value="Selling or promoting restricted items">Selling or promoting restricted items</option> <option value="Scam, fraud or impersonation">Scam, fraud or impersonation</option> <option value="I just don't like it">I just don't like it</option> <option value="Others">Others</option> </select> </div> <!-- Hidden textarea initially --> <div class="mb-3" id="otherReasonContainer" style="display: none;"> <label for="otherReasonTextarea" class="form-label">Please specify:</label> <textarea class="form-control" id="otherReasonTextarea" rows="3" placeholder="Describe your reason here"></textarea> </div> <input type="hidden" id="reportStreamId" value=""> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="button" id="submitReportButton" class="btn btn-primary">Submit</button> </div> </div> </div> </div> <!-- likedUsers Modal --> <div class="modal fade" id="likedUsersModal" tabindex="-1" aria-labelledby="likedUsersModalLabel" aria-hidden="true"> <div class="modal-dialog" style="width:fit-content"> <div class="modal-content" style="margin-left: 50px;"> <div class="modal-header"> <h5 class="modal-title" id="likedUsersModalLabel">People who liked this post</h5> </div> <div class="modal-body"> <ul id="likedUsersList" class="list-group"> <!-- Usernames will be dynamically inserted here --> </ul> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- Upload Modal --> <div class="modal fade" id="uploadModal" tabindex="-1" aria-labelledby="uploadModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content" style="margin-top: 20%;"> <div class="modal-header"> <h5 class="modal-title" id="uploadModalLabel">Share</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" style="background-color:#555"></button> </div> <div class="modal-body"> <!-- Your upload form goes here --> <div class="upload-section"> <div class="d-flex align-items-start"> <div class="w-100"> <div id="loadingIndicator" style="display: none; font-size: 14px; color: gray;">Generating<span id="dots">...</span></div> <div style="display: flex; align-items: center; gap: 10px;"> <textarea id="contentTextarea" class="form-control mb-2" placeholder="What would you like to share?" style="flex: 1; overflow: hidden; resize: none; min-height:180px;" oninput="adjustTextareaHeight(this)"></textarea> </div> <div class="d-flex justify-content-between align-items-center" style="padding:10px 0"> <div class="mediawithvisibility"> <input type="file" id="fileInput" accept="image/*,video/*" class="d-none" onchange="previewMedia();" multiple> <button type="button" class="btn btn-link text-decoration-none text-light bg-none" onclick="document.getElementById('fileInput').click();"> <i class="fa-solid fa-photo-film" style="color: #333;"></i> </button> <div class="form-group "> <label for="visibilitySelect">Who can see this post?</label> <select id="visibilitySelect" name="visibility" class="form-control"> <option value="public">Public</option> <option value="private">People I follow</option> <!-- <option value="">People I follow</option> --> </select> </div> </div> <div class="d-flex"> <button type="button" onclick="fetchGenAIContent()" style="text-decoration: none; border:none; border-radius:5px"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> <g fill="none" fill-rule="evenodd"> <path d="m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z" /> <path fill="currentColor" d="M19 19a1 1 0 0 1 .117 1.993L19 21h-7a1 1 0 0 1-.117-1.993L12 19zm.631-14.632a2.5 2.5 0 0 1 0 3.536L8.735 18.8a1.5 1.5 0 0 1-.44.305l-3.804 1.729c-.842.383-1.708-.484-1.325-1.326l1.73-3.804a1.5 1.5 0 0 1 .304-.44L16.096 4.368a2.5 2.5 0 0 1 3.535 0m-2.12 1.414L6.677 16.614l-.589 1.297l1.296-.59L18.217 6.49a.5.5 0 1 0-.707-.707M6 1a1 1 0 0 1 .946.677l.13.378a3 3 0 0 0 1.869 1.87l.378.129a1 1 0 0 1 0 1.892l-.378.13a3 3 0 0 0-1.87 1.869l-.129.378a1 1 0 0 1-1.892 0l-.13-.378a3 3 0 0 0-1.869-1.87l-.378-.129a1 1 0 0 1 0-1.892l.378-.13a3 3 0 0 0 1.87-1.869l.129-.378A1 1 0 0 1 6 1m0 3.196A5 5 0 0 1 5.196 5q.448.355.804.804q.355-.448.804-.804A5 5 0 0 1 6 4.196" /> </g> </svg> </button> <button class="btn btn-secondary ms-2" style="background-color: #db5919;" onclick="uploadPost(true)"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> <path fill="none" stroke="currentColor" d="m6.998 10.247l.435.76c.277.485.415.727.415.993s-.138.508-.415.992l-.435.761c-1.238 2.167-1.857 3.25-1.375 3.788c.483.537 1.627.037 3.913-.963l6.276-2.746c1.795-.785 2.693-1.178 2.693-1.832s-.898-1.047-2.693-1.832L9.536 7.422c-2.286-1-3.43-1.5-3.913-.963s.137 1.62 1.375 3.788Z" /> </svg> </button> </div> </div> <div id="mediaSlider" class="slider-container"> <div id="mediaSlides" class="slider-slides"> <!-- Dynamic media elements will be appended here (images or videos) --> </div> <button class="prev slideBtn" onclick="moveSlide(-1)">❮</button> <button class="next slideBtn" onclick="moveSlide(1)">❯</button> </div> <div id="linkPreview" class="mt-3" style="display: none; width: 100%; height:auto;"> <div class="hyperlink" style="padding: 10px;"> <img src="" alt="Card image"> <div style="padding: 0px; flex-grow: 1;"> <h3 id="linkHeading" style="font-size: 16px; margin: 0 0 5px; color: #333;"></h3> <p id="linkDesc" style="margin: 0 0 10px; font-size: 14px; color: #555; line-height: 1.4;"></p> <a id="linkUrl" href="" style="font-size: 13px; color: #007bff; text-decoration: none;"></a> </div> </div> </div> <div class="mb-3"> <label for="scheduleDate" class="form-label text-muted" style="margin-top: 10px;">Schedule Post</label> <div style="max-width: 220px;"> <input type="datetime-local" id="scheduleDate" class="form-control" /> <small class="text-muted">Format: mm/dd/yy</small> </div> </div> <div id="ytPreview" class="mt-3 ytprew"></div> <div id="loadingIcon" class="text-center" style="display:none;"> <div class="spinner-border" role="status"> <span class="sr-only">Loading...</span> </div> </div> <div> <input type="hidden" id="hiddenTitle"> <input type="hidden" id="hiddenDesc"> <input type="hidden" id="hiddenUrl"> <input type="hidden" id="hiddenImage"> <input type="hidden" id="hiddenDomain"> <input type="hidden" id="hiddenYTLink"> </div> </div> </div> </div> </div> </div> </div> </div> <!-- Media Modal --> <div id="mediaModal" class="modal fade" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div id="modalContent" style="max-width: auto; max-height: auto; transition: transform 0.3s ease;"> </div> </div> </div> <div id="channelModal" class="modal" style="display:none;"> <div class="modal-content"> <span class="close">×</span> <p id="modalChannelName"></p> </div> </div> <? include 'assets/php/footer.php' ?> <? include 'assets/php/bottom_navbar.php' ?> <div class="bookmarkNotification"></div> </body> </html>