fedi-tumblr/modules/settings.php
2021-09-24 14:02:28 -05:00

173 lines
7.5 KiB
PHP

<?php
if ($logedin){
$info = api_get("accounts/verify_credentials");
if($info['error']){
header('Location: ./logout');
}
}
?>
<div class='element'>
<div class='avatar' style='height:0px;'></div>
<div class='post' style='text-align:left;'>
<div style='padding:15px; width:90%; text-align:left; display:inline-block;' id="settings">
<h1><span class='fontello' style='font-size:inherit;'>&#xe82e;</span> Settings</h1>
<form method='post' enctype="multipart/form-data">
<input type='hidden' name='action' value='settings'>
<br>
<?php if ($logedin): ?>
<fieldset>
<legend>Account</legend>
<h2>Username</h2>
<div class='setting'>
<input type='text' name='username' value='<?php echo $info['display_name']; ?>'>
</div>
<h2>Bio</h2>
<div class='setting'>
<textarea name='bio' style='width:85%; height:100px'><?php
echo trim(strip_tags(str_replace(array("<br/>","<br />"),"\n",$info['note'])));
?></textarea>
</div>
<h2>Avatar</h2>
<div class='setting'>
<div class='avatar' style='height:80px; background-image:url("<?php echo $info['avatar']; ?>"); background-size:80px; margin-top:0px !important; margin-left:0px !important;'></div><input type='file' name='avatar'>
</div>
<div style='clear:both;'></div>
<h2>Header</h2>
<div class='setting' style='clear:both;'>
<div style='height:150px; width:300px; max-width:85%; background-image:url("<?php echo $info['header']; ?>"); background-size:cover; background-repeat: no-repeat; margin-top:0px !important; margin-left:0px !important;'></div><input type='file' name='header'>
</div>
</fieldset>
<?php endif; ?>
<fieldset>
<legend>Timeline</legend>
<?php if ($logedin): ?>
<h2>Default post vsibility</h2>
<div class="setting">
<select name='defscope' id='scope'>
<option value="1" <?php echo ($user_settings['defscope'] == '1' ? "selected" : ""); ?>>&#xe83c; Public</option>
<option value="2" <?php echo ($user_settings['defscope'] == '2' ? "selected" : ""); ?>>&#xe816; Unlisted</option>
<option value="3" <?php echo ($user_settings['defscope'] == '3' ? "selected" : ""); ?>>&#xe819; Private</option>
<option value="4" <?php echo ($user_settings['defscope'] == '4' ? "selected" : ""); ?>>&#xf0e0; Direct</option>
</select>
</div>
<h2>Show replies</h2>
<div class='setting'>
<select name="replies">
<option value="on" <?php echo ($user_settings['replies'] == 'on' ? "selected" : ""); ?>>All</option>
<option value="off" <?php echo ($user_settings['replies'] == 'off' ? "selected" : ""); ?>>Only to people i follow</option>
</select>
</div>
<?php endif; ?>
<h2>Show text-only posts</h2>
<div class='setting'>
<input type='radio' name='text' id='textOn' value='on' style='display:none;' <?php echo ($user_settings['text'] == 'on' ? "checked" : ""); ?>>
<label for='textOn'>Yes</label>
<input type='radio' name='text' id='textOff' value='off' style='display:none;' <?php echo ($user_settings['text'] == 'off' ? "checked" : ""); ?>>
<label for='textOff'>No</label>
</div>
<br><br>
<h2>Show reblogs</h2>
<div class='setting'>
<input type='radio' name='reblog' id='reblogOn' value='on' style='display:none;' <?php echo ($user_settings['reblog'] == 'on' ? "checked" : ""); ?>>
<label for='reblogOn'>Yes</label>
<input type='radio' name='reblog' id='reblogOff' value='off' style='display:none;' <?php echo ($user_settings['reblog'] == 'off' ? "checked" : ""); ?>>
<label for='reblogOff'>No</label>
</div>
<br><br>
<h2>Muted words</h2>
<span>One per line</span>
<div class='setting'>
<textarea name='mtwords' style='width:85%;'><?php
foreach($user_settings['mtwords'] as $word){
echo (empty($word) ? "" : trim($word)."\n");
}
?></textarea>
</div>
<h2>Followed hashtags</h2>
<span>One per line</span>
<div class='setting'>
<textarea name='fhtags' style='width:85%;'><?php
foreach($user_settings['fhtags'] as $word){
echo (empty($word) ? "" : trim($word)."\n");
}
?></textarea>
</div>
</fieldset>
<fieldset>
<legend>Attachments</legend>
<h2>Hide Attachments, show a link instead.</h2>
<div class='setting'>
<input type='radio' name='attach' id='a_hide' value='off' style='display:none;' <?php echo ($user_settings['attach'] == 'off' ? "checked" : ""); ?>>
<label for='a_hide'>Yes</label>
<input type='radio' name='attach' id='a_show' value='on' style='display:none;' <?php echo ($user_settings['attach'] == 'on' ? "checked" : ""); ?>>
<label for='a_show'>No</label>
</div>
<br><br>
<h2>Sensitive Media</h2>
<div class='setting'>
<input type='radio' name='explicit' id='hide' value='hide' style='display:none;' <?php echo ($user_settings['explicit'] == 'hide' ? "checked" : ""); ?>>
<label for='hide'>Hide</label>
<input type='radio' name='explicit' id='blur' value='blur' style='display:none;' <?php echo ($user_settings['explicit'] == 'blur' ? "checked" : ""); ?>>
<label for='blur'>Blur</label>
<input type='radio' name='explicit' id='show' value='off' style='display:none;' <?php echo ($user_settings['explicit'] == 'off' ? "checked" : ""); ?>>
<label for='show'>Show</label>
</div>
<br><br>
<h2>Loop videos</h2>
<div class='setting'>
<input type='radio' name='videoloop' id='loopOn' value='on' style='display:none;' <?php echo ($user_settings['videoloop'] == 'on' ? "checked" : ""); ?>>
<label for='loopOn'>Yes</label>
<input type='radio' name='videoloop' id='loopOff' value='off' style='display:none;' <?php echo ($user_settings['videoloop'] == 'off' ? "checked" : ""); ?>>
<label for='loopOff'>No</label>
</div>
</fieldset>
<fieldset>
<legend>User Interface</legend>
<h2>Theme.</h2>
<select name='theme' onChange='themecheck(this)'>
<?php
echo "<option value='default' ".($user_settings['theme'] == "default" ? "selected" : "").">default</option>";
foreach(themes("list") as $name){
echo "<option value='$name' ".($user_settings['theme'] == $name ? "selected" : "").">$name</option>";
}
echo "<option value='custom' ".($user_settings['theme'] == "custom" ? "selected" : "").">custom</option>";
?>
</select>
<div id="customtheme"<?php echo ($user_settings['theme'] == "custom" ? "" : "style='display:none;'");?>>
<fieldset>
<legend>Custom Colors</legend>
Foreground:<br>
<input type="color" name="fg" value="#<?php echo (!empty($theme) ? $theme['fg'] : "#ffffff");?>"><br><br>
Background:<br>
<input type="color" name="bg" value="#<?php echo (!empty($theme) ? $theme['bg'] : "#2b475d");?>"><br><br>
Text Color:<br>
<input type="color" name="tx" value="#<?php echo (!empty($theme) ? $theme['tx'] : "#000000");?>"><br><br>
Link Color:<br>
<input type="color" name="lc" value="#<?php echo (!empty($theme) ? $theme['lc'] : "#4682b4");?>"><br><br>
Border Color:<br>
<input type="color" name="bc" value="#<?php echo (!empty($theme) ? $theme['bc'] : "#ffffff");?>"><br><br>
Border Width:<br>
<input type="text" name="bw" value="<?php echo (!empty($theme) ? $theme['bw'] : "0");?>"><br><br>
Border Radius:<br>
<input type="text" name="br" value="<?php echo (!empty($theme) ? $theme['br'] : "3");?>"><br><br>
</fieldset>
</div>
</fieldset>
<br><br>
<br><br>
<input type="submit" value="Save" id="send">
</form>
</div>
</div>
</div>