-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
203 lines (182 loc) · 9.61 KB
/
dashboard.php
File metadata and controls
203 lines (182 loc) · 9.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?php
require_once 'config.php';
// Oturum kontrolü - YÖNLENDİRME YERİNE SADECE BİLGİ VER
$loggedIn = !empty($_SESSION['user']);
if (!$loggedIn) {
// Yönlendirme YAPMA — JS modal'ı açsın diye bekle
// Sadece bilgi olarak tutalım
}
$pageTitle = "Ayarlar Dashboard";
$extraScripts = ['dashboard.js', 'auth.js'];
require 'assets/templates/header.php';
require 'assets/templates/modals.php'; // Login modalı da burada
?>
<div class="container">
<?php if (!$loggedIn): ?>
<!-- JS modal'ı açacak, ama kullanıcıya bilgi verelim -->
<div class="card error" style="text-align:center; padding:30px;">
<h2><i class="fas fa-lock"></i> Erişim Kısıtlı</h2>
<p>Dashboard'a erişmek için lütfen giriş yapın.</p>
<button onclick="openLoginModal()" class="btn-action" style="margin-top:20px;">
<i class="fas fa-sign-in-alt"></i> Giriş Yap
</button>
</div>
<?php else: ?>
<!-- Header -->
<div class="header" style="margin: -20px -20px 40px -20px; border-radius: 16px 16px 0 0;">
<h1>Ayarlar Dashboard</h1>
<p class="tagline">Platformları yönetin · Yeni yöntemler ekleyin · Görünümü özelleştirin</p>
</div>
<!-- Kullanıcı Bilgisi -->
<div class="user-info" style="margin-bottom: 30px; display: flex; align-items: center; gap: 15px; font-size: 1.1rem;">
<img src="<?= htmlspecialchars($_SESSION['user']['picture'] ?? 'https://via.placeholder.com/50') ?>" width="50" height="50" style="border-radius: 50%;">
<div>
<strong><?= htmlspecialchars($_SESSION['user']['name'] ?? 'Yönetici') ?></strong><br>
<a href="<?= BASE_URL ?>engine/auth/logout.php" style="color: var(--error); font-size: 0.9rem;">Çıkış Yap</a>
<span style="margin: 0 10px;">·</span>
<a href="<?= BASE_URL ?>" style="color: var(--primary);">Ana Sayfaya Dön</a>
</div>
</div>
<!-- Hızlı Eylemler -->
<div class="action-buttons" style="margin-bottom: 30px; display: flex; flex-wrap: wrap; gap: 15px;">
<button onclick="openEditModal()" class="btn-action">
<i class="fas fa-plus"></i> Yeni Platform Ekle
</button>
<button onclick="generateScraper()" class="btn-action">
<i class="fas fa-sync-alt"></i> Scraper'ları Yeniden Oluştur
</button>
<a href="<?= BASE_URL ?>engine/export-scraper.php" class="btn-action secondary">
<i class="fas fa-download"></i> Tüm Ayarları Dışa Aktar
</a>
</div>
<!-- Platform Tablosu -->
<div class="card">
<h2 style="margin-bottom: 20px;">
<i class="fab fa-hubspot"></i> Platformlar
</h2>
<div class="table-responsive">
<table id="platformTable" class="full-width">
<thead>
<tr>
<th>Platform</th>
<th>Durum</th>
<th>Son Profiller Limiti</th>
<th>İşlemler</th>
</tr>
</thead>
<tbody>
<!-- dashboard.js ile dinamik doldurulacak -->
</tbody>
</table>
</div>
</div>
<!-- Composer Rehberi -->
<div class="card success" style="margin-top: 30px;">
<h2><i class="fas fa-gem"></i> Composer Paketleri InfinityFree'de Çalışır!</h2>
<p>Resmi API'lerle (Instagram Graph, Twitter v2 vb.) daha stabil erişim için:</p>
<ol>
<li>Yerelinizde <code>composer require league/oauth2-facebook guzzlehttp/guzzle</code> vb. çalıştırın</li>
<li>Oluşan <code>vendor/</code> klasörünü FTP ile yükleyin</li>
<li>İlgili dosyalara <code>require 'vendor/autoload.php';</code> ekleyin</li>
</ol>
</div>
<!-- Tema Düzenleyici -->
<div class="card" style="margin-top: 30px;">
<h2><i class="fas fa-palette"></i> Tema & Stil Düzenleyici</h2>
<form action="<?= BASE_URL ?>engine/save-custom-css.php" method="POST">
<textarea name="custom_css" id="customCssEditor" rows="12" style="width:100%; font-family: 'Courier New', monospace; padding: 15px; border-radius: 8px; border: 1px solid var(--light-dark); background: #f8f9fa;">
<?= file_exists('assets/css/custom.css') ? htmlspecialchars(file_get_contents('assets/css/custom.css')) : "/* Özel CSS kodlarınızı buraya yazın */\n\n/* Örnek: Karanlık mod */\n/*\nbody { background: #121212; color: #e0e0e0; }\n.card { background: #1e1e1e; }\n*/" ?>
</textarea>
<button type="submit" class="btn-action" style="margin-top: 15px;">
<i class="fas fa-save"></i> Kaydet ve Uygula
</button>
</form>
</div>
<!-- Yapay Zeka Rehberi -->
<div class="card info" style="margin-top: 30px;">
<h2><i class="fas fa-robot"></i> Yapay Zeka ile Yöntem Geliştirme</h2>
<p>Platform değiştiğinde şu promptu Grok/ChatGPT'ye verin:</p>
<pre style="background: #f0f0f0; padding: 15px; border-radius: 8px; overflow-x: auto;">
Instagram profil resmi şu endpointten geliyor: https://i.instagram.com/api/v1/users/web_profile_info/?username=xyz
Header: x-ig-app-id: 936619743392459
JSON path: data.user.profile_pic_url_hd
s150x150 → s1080x1080 optimize et
Bunu PHP cURL ile nasıl çekerim?</pre>
</div>
<?php endif; ?>
</div>
<!-- Platform Düzenleme Modal'ı - Orijinal stillerle %100 uyumlu -->
<div id="editModal" class="modal">
<div class="modal-content large">
<span class="close" onclick="closeModal()">❎</span>
<div class="modal-header" style="background: var(--primary);">
<h2 id="modalTitle" style="margin:0; color:white;">Platform Düzenle</h2>
</div>
<div class="modal-body">
<form id="editForm">
<input type="hidden" id="platformKey">
<div class="input-group" style="margin-bottom: 20px;">
<label>Platform Adı</label>
<input type="text" id="name" required>
</div>
<div class="input-group HIZLI">
<label>Renk (HEX)</label>
<input type="color" id="color" value="#E1306C">
</div>
<div class="input-group">
<label>İkon (FontAwesome)</label>
<input type="text" id="icon" placeholder="fab fa-instagram">
</div>
<div class="input-group">
<label>User-Agent</label>
<textarea id="user_agent" rows="3" style="width:100%; font-family: monospace; padding: 10px; border-radius: 8px; border: 1px solid var(--light-dark);"><?= htmlspecialchars($plat['user_agent'] ?? '') ?></textarea>
<small>Platforma özel tarayıcı kimliği</small>
</div>
<div class="input-group">
<label>Varsayılan Header'lar (satır satır key: value)</label>
<textarea id="default_headers" rows="8" style="width:100%; font-family: monospace; padding: 10px; border-radius: 8px; border: 1px solid var(--light-dark);"><?= htmlspecialchars($plat['default_headers'] ? implode("\n", array_map(fn($k,$v) => "$k: $v", array_keys($plat['default_headers']), $plat['default_headers'])) : '') ?></textarea>
<small>Her istekte otomatik eklenecek header'lar</small>
</div>
<div class="input-group">
<label>URL Tespit Pattern (virgülle ayrılmış)</label>
<input type="text" id="detect_patterns" placeholder="instagram.com, i.instagram.com">
</div>
<div class="input-group">
<label>Profil URL Şablonu</label>
<input type="text" id="profile_url_pattern" placeholder="https://www.instagram.com/{identifier}/">
</div>
<h3 style="margin: 30px 0 15px;">Çekilecek İçerikler</h3>
<div class="checkbox-group" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px;">
<label><input type="checkbox" id="content_profile_picture" checked> Profil Resmi</label>
<label><input type="checkbox" id="content_cover_photo"> Kapak Resmi</label>
<label><input type="checkbox" id="content_highlighted_stories"> Öne Çıkanlar</label>
<label><input type="checkbox" id="content_recent_posts"> Son Postlar</label>
<label><input type="checkbox" id="content_post_thumbnails"> Post Thumbnail</label>
</div>
<h3 style="margin: 30px 0 15px;">Scraping Yöntemleri</h3>
<div id="methodsContainer"></div>
<button type="button" onclick="addNewMethod()" class="btn-action secondary" style="margin-top: 10px;">
<i class="fas fa-plus"></i> Yeni Yöntem Ekle
</button>
<div style="margin-top: 30px; text-align: right;">
<button type="button" onclick="savePlatform()" class="btn-action">
<i class="fas fa-save"></i> Kaydet
</button>
</div>
</form>
</div>
</div>
</div>
<script>
// Sayfa yüklendiğinde oturum kontrolü yap
document.addEventListener('DOMContentLoaded', function() {
fetch('<?= BASE_URL ?>engine/auth/check.php')
.then(r => r.json())
.then(data => {
if (!data.logged_in) {
openLoginModal();
}
});
});
</script>
<?php require 'assets/templates/footer.php'; ?>