| 1 | <?
|
|---|
| 2 |
|
|---|
| 3 | /***************************************************************************
|
|---|
| 4 | * Dolphin Smart Community Builder
|
|---|
| 5 | * -----------------
|
|---|
| 6 | * begin : Mon Mar 23 2006
|
|---|
| 7 | * copyright : (C) 2006 BoonEx Group
|
|---|
| 8 | * website : http://www.boonex.com/
|
|---|
| 9 | * This file is part of Dolphin - Smart Community Builder
|
|---|
| 10 | *
|
|---|
| 11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
|---|
| 12 | * http://creativecommons.org/licenses/by/3.0/
|
|---|
| 13 | *
|
|---|
| 14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|---|
| 15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 16 | * See the Creative Commons Attribution 3.0 License for more details.
|
|---|
| 17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
|---|
| 18 | * see license.txt file; if not, write to marketing@boonex.com
|
|---|
| 19 | ***************************************************************************/
|
|---|
| 20 |
|
|---|
| 21 | require_once( 'inc/header.inc.php' );
|
|---|
| 22 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
|---|
| 23 | require_once( BX_DIRECTORY_PATH_INC . 'images.inc.php' );
|
|---|
| 24 | require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
|
|---|
| 25 |
|
|---|
| 26 | // --------------- page variables and login
|
|---|
| 27 |
|
|---|
| 28 | $_page['name_index'] = 58;
|
|---|
| 29 | $_page['css_name'] = 'profile_customize.css';
|
|---|
| 30 |
|
|---|
| 31 | $logged['member'] = member_auth();
|
|---|
| 32 |
|
|---|
| 33 | if ( !getParam('enable_customization') )
|
|---|
| 34 | {
|
|---|
| 35 | $_page['name_index'] = 0;
|
|---|
| 36 | $_page_cont[0]['page_main_code'] = '';
|
|---|
| 37 | PageCode();
|
|---|
| 38 | exit();
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | $ID = (int)$_COOKIE['memberID'];
|
|---|
| 42 |
|
|---|
| 43 | // -------------------------------------------------------------------------------------
|
|---|
| 44 | // save profile visualization settings
|
|---|
| 45 | // -------------------------------------------------------------------------------------
|
|---|
| 46 |
|
|---|
| 47 | if ( $_POST['reset'] )
|
|---|
| 48 | {
|
|---|
| 49 |
|
|---|
| 50 | $query = "SELECT `BackgroundFilename` FROM `ProfilesSettings` WHERE `IDMember` = '$ID';";
|
|---|
| 51 | $custom_arr = db_arr( $query );
|
|---|
| 52 | if ( strlen($custom_arr['BackgroundFilename']) && file_exists($dir['profileBackground'] . $custom_arr['BackgroundFilename']) && is_file($dir['profileBackground'] . $custom_arr['BackgroundFilename']) )
|
|---|
| 53 | @unlink($dir['profileBackground'] . $custom_arr['BackgroundFilename']);
|
|---|
| 54 |
|
|---|
| 55 | $query = "DELETE FROM `ProfilesSettings` WHERE `IDMember`='$ID' LIMIT 1";
|
|---|
| 56 | db_res( $query );
|
|---|
| 57 |
|
|---|
| 58 | }
|
|---|
| 59 | else if ( $_POST['save'] )
|
|---|
| 60 | {
|
|---|
| 61 |
|
|---|
| 62 | $query = "SELECT * FROM `ProfilesSettings` WHERE `IDMember` = '$ID';";
|
|---|
| 63 | $custom_arr = db_arr( $query );
|
|---|
| 64 | $record_created = $custom_arr['IDMember'] ? 'ok' : '';
|
|---|
| 65 |
|
|---|
| 66 | // bg image ----------------------------------------------------------------------------
|
|---|
| 67 | if ( $_FILES['bgimg']['name'] && !$_POST['bgdel'] )
|
|---|
| 68 | {
|
|---|
| 69 |
|
|---|
| 70 | if ( strlen($custom_arr['BackgroundFilename']) && file_exists($dir['profileBackground'] . $custom_arr['BackgroundFilename']) && is_file($dir['profileBackground'] . $custom_arr['BackgroundFilename']) )
|
|---|
| 71 | @unlink($dir['profileBackground'] . $custom_arr['BackgroundFilename']);
|
|---|
| 72 |
|
|---|
| 73 | srand(time());
|
|---|
| 74 | $pic_name = $ID . '_bg_' . rand(100, 999);
|
|---|
| 75 |
|
|---|
| 76 | if ( !is_int($ext = moveUploadedImage( $_FILES, 'bgimg', $dir['profileBackground'] . $pic_name, '',false) ) )
|
|---|
| 77 | {
|
|---|
| 78 | if ( !$record_created )
|
|---|
| 79 | {
|
|---|
| 80 | $query = "INSERT INTO ProfilesSettings (`IDMember`, `BackgroundFilename` ) VALUES ( '$ID', '$pic_name$ext' )";
|
|---|
| 81 | $record_created = 'ok';
|
|---|
| 82 | }
|
|---|
| 83 | else
|
|---|
| 84 | {
|
|---|
| 85 | $query = "UPDATE ProfilesSettings SET `BackgroundFilename` = '$pic_name$ext', `Status` = 'Approval' WHERE `IDMember` = '$ID'";
|
|---|
| 86 | }
|
|---|
| 87 | $res = db_res( $query );
|
|---|
| 88 |
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | }
|
|---|
| 92 | else if ( $_POST['bgdel'] )
|
|---|
| 93 | {
|
|---|
| 94 |
|
|---|
| 95 | if ( $custom_arr['BackgroundFilename'] )
|
|---|
| 96 | {
|
|---|
| 97 | if (file_exists($dir['profileBackground'] . $custom_arr['BackgroundFilename'])) unlink($dir['profileBackground'] . $custom_arr['BackgroundFilename']);
|
|---|
| 98 |
|
|---|
| 99 | $query = "UPDATE ProfilesSettings SET `BackgroundFilename` = '' WHERE `IDMember` = '$ID'";
|
|---|
| 100 | $res = db_res( $query );
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 | // bg color ----------------------------------------------------------------------------
|
|---|
| 107 | if ( $_POST['bgcolor'] && $_POST['bgcolor'] != $custom_arr['BackgroundColor'] )
|
|---|
| 108 | {
|
|---|
| 109 | if ( !$record_created )
|
|---|
| 110 | {
|
|---|
| 111 | $query = "INSERT INTO ProfilesSettings (`IDMember`, `BackgroundColor` ) VALUES ( '$ID', '{$_POST['bgcolor']}' )";
|
|---|
| 112 | $record_created = 'ok';
|
|---|
| 113 | }
|
|---|
| 114 | else
|
|---|
| 115 | $query = "UPDATE ProfilesSettings SET `BackgroundColor` = '{$_POST['bgcolor']}' WHERE `IDMember` = '$ID'";
|
|---|
| 116 |
|
|---|
| 117 | $res = db_res( $query );
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | // font color ----------------------------------------------------------------------------
|
|---|
| 121 | if ( $_POST['fontcolor'] && $_POST['fontcolor'] != $custom_arr['FontColor'] )
|
|---|
| 122 | {
|
|---|
| 123 | if ( !$record_created )
|
|---|
| 124 | {
|
|---|
| 125 | $query = "INSERT INTO ProfilesSettings (`IDMember`, `FontColor` ) VALUES ( '$ID', '{$_POST['fontcolor']}' )";
|
|---|
| 126 | $record_created = 'ok';
|
|---|
| 127 | }
|
|---|
| 128 | else
|
|---|
| 129 | $query = "UPDATE ProfilesSettings SET `FontColor` = '{$_POST['fontcolor']}' WHERE `IDMember` = '$ID'";
|
|---|
| 130 |
|
|---|
| 131 | $res = db_res( $query );
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | // font size ----------------------------------------------------------------------------
|
|---|
| 135 | if ( $_POST['fontsize'] && $_POST['fontsize'] != $custom_arr['FontSize'] )
|
|---|
| 136 | {
|
|---|
| 137 | if ( !$record_created )
|
|---|
| 138 | {
|
|---|
| 139 | $query = "INSERT INTO ProfilesSettings (`IDMember`, `FontSize` ) VALUES ( '$ID', '{$_POST['fontsize']}' )";
|
|---|
| 140 | $record_created = 'ok';
|
|---|
| 141 | }
|
|---|
| 142 | else
|
|---|
| 143 | $query = "UPDATE ProfilesSettings SET `FontSize` = '{$_POST['fontsize']}' WHERE `IDMember` = '$ID'";
|
|---|
| 144 |
|
|---|
| 145 | $res = db_res( $query );
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | // font family ----------------------------------------------------------------------------
|
|---|
| 149 | if ( $_POST['fontfamily'] && $_POST['fontfamily'] != $custom_arr['FontFamily'] )
|
|---|
| 150 | {
|
|---|
| 151 | if ( !$record_created )
|
|---|
| 152 | {
|
|---|
| 153 | $query = "INSERT INTO ProfilesSettings (`IDMember`, `FontFamily` ) VALUES ( '$ID', '{$_POST['fontfamily']}' )";
|
|---|
| 154 | $record_created = 'ok';
|
|---|
| 155 | }
|
|---|
| 156 | else
|
|---|
| 157 | $query = "UPDATE ProfilesSettings SET `FontFamily` = '{$_POST['fontfamily']}' WHERE `IDMember` = '$ID'";
|
|---|
| 158 |
|
|---|
| 159 | $res = db_res( $query );
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 | }
|
|---|
| 164 | // -------------------------------------------------------------------------------------
|
|---|
| 165 | // ============================================================================== end ==
|
|---|
| 166 | // -------------------------------------------------------------------------------------
|
|---|
| 167 |
|
|---|
| 168 | $_page['header'] = _t("_Customize");
|
|---|
| 169 | $_page['header_text'] = _t("_Customize");
|
|---|
| 170 |
|
|---|
| 171 | // --------------- page components
|
|---|
| 172 |
|
|---|
| 173 | $_ni = $_page['name_index'];
|
|---|
| 174 | $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
|
|---|
| 175 |
|
|---|
| 176 | // --------------- [END] page components
|
|---|
| 177 |
|
|---|
| 178 | PageCode();
|
|---|
| 179 |
|
|---|
| 180 | // --------------- page components functions
|
|---|
| 181 |
|
|---|
| 182 | /**
|
|---|
| 183 | * page code function
|
|---|
| 184 | */
|
|---|
| 185 | function PageCompPageMainCode()
|
|---|
| 186 | {
|
|---|
| 187 | global $ID;
|
|---|
| 188 | global $site;
|
|---|
| 189 |
|
|---|
| 190 | $query = "SELECT * FROM `ProfilesSettings` WHERE `IDMember` = '$ID'";
|
|---|
| 191 | $custom_arr = db_arr( $query );
|
|---|
| 192 |
|
|---|
| 193 | $bgimage = $custom_arr['BackgroundFilename'];
|
|---|
| 194 | $bgimage = $bgimage ? "<img src=\"{$site['profileBackground']}$bgimage\" alt=\"background\" width=\"110\" height=\"110\">" : '';
|
|---|
| 195 |
|
|---|
| 196 | $bgcolor = $custom_arr['BackgroundColor'] ? $custom_arr['BackgroundColor'] : '#FFFFFF';
|
|---|
| 197 | $bgcolorselect = makeColorSelect( 'bgcolor', $bgcolor );
|
|---|
| 198 | $bgcolor = $bgcolor ? "<div style=\"background: $bgcolor;width:25px;height:12px;border: solid 1px #000000;\"> </div>" : "<div style=\"width:30px;height:12px;border: solid 1px #000000;\">none</div>";
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 | $fontcolor = $custom_arr['FontColor'];
|
|---|
| 202 | $fontcolor = $fontcolor ? "<div style=\"background: $fontcolor;width:25px;height:12px;border: solid 1px #000000;\"> </div>" : "<div style=\"width:30px;height:12px;border: solid 1px #000000;\">none</div>";
|
|---|
| 203 | $fontcolorselect = makeColorSelect( 'fontcolor', $custom_arr['FontColor'] );
|
|---|
| 204 |
|
|---|
| 205 | $fontsize = $custom_arr['FontSize'] ? $custom_arr['FontSize'] : '11';
|
|---|
| 206 | $fontsizeselect = "<select id=\"fontsize\" name=\"fontsize\">";
|
|---|
| 207 | for ( $i = 8; $i<=16; $i++ )
|
|---|
| 208 | {
|
|---|
| 209 | $selected = $i == $fontsize ? 'selected="selected"' : '';
|
|---|
| 210 | $fontsizeselect .= "<option value=\"{$i}\" $selected style=\"font-size: {$i}px;font-weight: bold;\">{$i}px</option>";
|
|---|
| 211 | }
|
|---|
| 212 | $fontsizeselect .= '</select>';
|
|---|
| 213 | $fontsize = $fontsize ? "<font style=\"font-size: {$fontsize}px;\">{$fontsize}px</font>" : '';
|
|---|
| 214 |
|
|---|
| 215 | $fontfamily_arr[0] = 'Arial, Helvetica, sans-serif';
|
|---|
| 216 | $fontfamily_arr[1] = 'Times New Roman, Times, serif';
|
|---|
| 217 | $fontfamily_arr[2] = 'Courier New, Courier, monospace';
|
|---|
| 218 | $fontfamily_arr[3] = 'Georgia, Times New Roman, Times, serif';
|
|---|
| 219 | $fontfamily_arr[4] = 'Verdana, Arial, Helvetica, sans-serif';
|
|---|
| 220 | $fontfamily_arr[5] = 'Geneva, Arial, Helvetica, sans-serif';
|
|---|
| 221 |
|
|---|
| 222 | $fontfamily = $custom_arr['FontFamily'];
|
|---|
| 223 | $fontfamily = $fontfamily ? "<font style=\"font-family: {$fontfamily};\">{$fontfamily}</font>" : '';
|
|---|
| 224 | $fontfamilyselect = "<select id=\"fontfamily\" name=\"fontfamily\">";
|
|---|
| 225 | for ( $i = 0; $i<count($fontfamily_arr); $i++ )
|
|---|
| 226 | {
|
|---|
| 227 | $selected = $fontfamily_arr[$i] == $custom_arr['FontFamily'] ? 'selected="selected"' : '';
|
|---|
| 228 | $fontfamilyselect .= "<option value=\"{$fontfamily_arr[$i]}\" $selected style=\"font-family: {$fontfamily_arr[$i]};font-weight: bold;\">$fontfamily_arr[$i]</option>";
|
|---|
| 229 | }
|
|---|
| 230 | $fontfamilyselect .= '</select>';
|
|---|
| 231 |
|
|---|
| 232 | ob_start();
|
|---|
| 233 |
|
|---|
| 234 | ?>
|
|---|
| 235 | <div class="customize_content">
|
|---|
| 236 | <form id="cprofile" name="cprofile" enctype="multipart/form-data" action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
|
|---|
| 237 | <input name="ID" value="<?= $ID ?>" type="hidden" />
|
|---|
| 238 | <div class="customize_header_box">
|
|---|
| 239 | <b><?= _t('_Customize Profile') ?>:</b>
|
|---|
| 240 | </div>
|
|---|
| 241 |
|
|---|
| 242 | <div id="profile_bg_color" class="customize_box">
|
|---|
| 243 | <span class="left_box"><b><?= _t('_Background color') ?></b><br /><?= $bgcolor ?></span>
|
|---|
| 244 | <span class="right_box"><?= $bgcolorselect ?></span>
|
|---|
| 245 | <div class="devider"></div>
|
|---|
| 246 | </div>
|
|---|
| 247 |
|
|---|
| 248 | <div id="profile_bg_image" class="customize_box_pic">
|
|---|
| 249 | <div><b><?= _t('_Background picture') ?></b><br /><?= $bgimage ?></div>
|
|---|
| 250 | <span class="right_box">
|
|---|
| 251 | <input class="no" id="bgimg" name="bgimg" value="upload" type="file" /><br />
|
|---|
| 252 | <input type="checkbox" id="bgdel" name="bgdel" /><label for="bgdel"><?= _t('_Delete') ?></label>
|
|---|
| 253 | </span>
|
|---|
| 254 | </div>
|
|---|
| 255 |
|
|---|
| 256 | <div id="profile_font_color" class="customize_box">
|
|---|
| 257 | <span class="left_box"><b><?= _t('_Font color') ?></b><br /><?= $fontcolor ?></span>
|
|---|
| 258 | <span class="right_box"><?= $fontcolorselect ?></span>
|
|---|
| 259 | </div>
|
|---|
| 260 |
|
|---|
| 261 | <div id="profile_font_size" class="customize_box">
|
|---|
| 262 | <span class="left_box"><b><?= _t('_Font size') ?></b><br /><?= $fontsize ?></span>
|
|---|
| 263 | <span class="right_box"><?= $fontsizeselect ?></span>
|
|---|
| 264 | </div>
|
|---|
| 265 |
|
|---|
| 266 | <div id="profile_font_family" class="customize_box">
|
|---|
| 267 | <span class="left_box"><b><?= _t('_Font family') ?></b><br /><?= $fontfamily ?></span>
|
|---|
| 268 | <span class="right_box"><?= $fontfamilyselect ?></span>
|
|---|
| 269 | </div>
|
|---|
| 270 |
|
|---|
| 271 | <div class="customize_footer_box">
|
|---|
| 272 | <input class="button" name="save" value="<?= _t('_Save Changes') ?>" type="submit" style="width: 100px;" />
|
|---|
| 273 | <input class="button" name="reset" value="<?= _t('_Reset') ?>" type="submit" style="width: 60px;" />
|
|---|
| 274 | <br /><br />
|
|---|
| 275 | <a href="<?=getProfileLink($ID); ?>" style="font-weight: bold;"><?= _t('_View profile') ?></a>
|
|---|
| 276 | </div>
|
|---|
| 277 | </form>
|
|---|
| 278 | </div>
|
|---|
| 279 | <?
|
|---|
| 280 |
|
|---|
| 281 | $ret = ob_get_contents();
|
|---|
| 282 | ob_end_clean();
|
|---|
| 283 |
|
|---|
| 284 | return $ret;
|
|---|
| 285 | }
|
|---|
| 286 |
|
|---|
| 287 | function makeColorSelect( $name, $sel )
|
|---|
| 288 | {
|
|---|
| 289 | $res = db_res( "SELECT `ColorName`, `ColorCode` FROM `ColorBase` ORDER BY `ColorCode`" );
|
|---|
| 290 |
|
|---|
| 291 | $ret = "<select id=\"$name\" name=\"$name\">\n";
|
|---|
| 292 | while ( $arr = mysql_fetch_assoc($res) )
|
|---|
| 293 | {
|
|---|
| 294 | $selected = ($sel == $arr['ColorCode'] ? 'selected="selected"' : '');
|
|---|
| 295 | $ret .= "<option value=\"{$arr['ColorCode']}\" $selected style=\"color: {$arr['ColorCode']}; font-weight: bold;\">{$arr['ColorName']}</option>\n";
|
|---|
| 296 | }
|
|---|
| 297 | $ret .= "</select>\n";
|
|---|
| 298 |
|
|---|
| 299 | return $ret;
|
|---|
| 300 | }
|
|---|
| 301 |
|
|---|
| 302 | ?> |
|---|