├── LICENSE ├── assets ├── css │ ├── bootstrap.css │ ├── jquery.Jcrop.css │ ├── register_style.css │ └── style.css ├── fonts │ ├── Bellota-Bold.otf │ ├── Bellota-BoldItalic.otf │ ├── Bellota-Italic.otf │ ├── Bellota-Light.otf │ ├── Bellota-LightItalic.otf │ └── Bellota-Regular.otf ├── images │ ├── backgrounds │ │ └── desktop.jpg │ ├── icons │ │ ├── loading.gif │ │ └── magnifying_glass.png │ ├── posts │ │ ├── 5947799f01421308Image.jpg │ │ ├── 59477a06cc889harrysImage.jpg │ │ ├── 5bf807e59753dai.jpeg │ │ ├── 5bf8234020124YASWANTH SAI PALAGHAT-1.jpg │ │ ├── 5bf82353605a8YASWANTH SAI PALAGHAT-1.jpg │ │ ├── 5bf8235e383dcYASWANTH SAI PALAGHAT-1.jpg │ │ ├── 5bf82d922d230YASWANTH SAI PALAGHAT (6).png │ │ ├── 5bf830adb24adYASWANTH SAI PALAGHAT (6).png │ │ ├── 5bf83105e99d6YASWANTH SAI PALAGHAT (6).png │ │ ├── 5bf83135d09d6YASWANTH SAI PALAGHAT (6).png │ │ ├── 5bf8314b63566YASWANTH SAI PALAGHAT (6).png │ │ ├── 5bf8315795ff2YASWANTH SAI PALAGHAT (6).png │ │ ├── 5bf831750c46eYASWANTH SAI PALAGHAT (6).png │ │ ├── 5bf8320ead1dfYASWANTH SAI PALAGHAT (6).png │ │ ├── 5bf83abe789afai3.jpg │ │ ├── 5bf83ac82e247ai3.jpg │ │ ├── 5bf83acd30957ai3.jpg │ │ └── 5bfaf25c3f0acai.jpeg │ └── profile_pics │ │ ├── bart_simpson37e241c20f54539e5304221e3cdb301an.jpeg │ │ ├── captain_america42ec2eed5d26bc70eacc842160a47a71n.jpeg │ │ ├── defaults │ │ ├── head_alizarin.png │ │ ├── head_amethyst.png │ │ ├── head_belize_hole.png │ │ ├── head_carrot.png │ │ ├── head_deep_blue.png │ │ ├── head_emerald.png │ │ ├── head_green_sea.png │ │ ├── head_nephritis.png │ │ ├── head_pete_river.png │ │ ├── head_pomegranate.png │ │ ├── head_pumpkin.png │ │ ├── head_red.png │ │ ├── head_sun_flower.png │ │ ├── head_turqoise.png │ │ ├── head_wet_asphalt.png │ │ └── head_wisteria.png │ │ ├── goofy_mouse9ddceb032f4c9ad008be1aa646a18e94n.jpeg │ │ ├── goofy_mousef23548fb257c3489bd35e362e71203c8n.jpeg │ │ ├── homer_simpson411f23038880f46914f888ad170cdce0n.jpeg │ │ ├── homer_simpson96b166fee6674f498f207fdf9b7089c0n.jpeg │ │ ├── little_mac9cfacd93b608dce648d5f43013e3c975n.jpeg │ │ ├── reece_kenney_122c9660b9d1eedcaf99c04ab974cab44n.jpeg │ │ ├── reece_kenney_133159c4b4790562ba0ea8bdefde17261n.jpeg │ │ ├── yaswanth_palaghat47ec7ac91a34019876f060e9045ec9e5n.jpeg │ │ └── yaswanth_palaghat92ed9d1a43632b6a58224c0e21ec70b3n.jpeg └── js │ ├── bootbox.min.js │ ├── bootstrap.js │ ├── demo.js │ ├── jcrop_bits.js │ ├── jquery.Jcrop.js │ └── register.js ├── close_account.php ├── comment_frame.php ├── config └── config.php ├── includes ├── classes │ ├── Message.php │ ├── Notification.php │ ├── Post.php │ └── User.php ├── form_handlers │ ├── delete_post.php │ ├── login_handler.php │ ├── register_handler.php │ └── settings_handler.php ├── handlers │ ├── ajax_delete_message.php │ ├── ajax_friend_search.php │ ├── ajax_load_messages.php │ ├── ajax_load_notifications.php │ ├── ajax_load_posts.php │ ├── ajax_load_profile_posts.php │ ├── ajax_search.php │ ├── ajax_submit_profile_post.php │ └── logout.php └── header.php ├── index.php ├── like.php ├── messages.php ├── post.php ├── profile.php ├── readme.md ├── register.php ├── requests.php ├── search.php ├── settings.php ├── social.sql ├── upload.php └── user_closed.php /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Yaswanth Sai Palaghat 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /assets/css/jquery.Jcrop.css: -------------------------------------------------------------------------------- 1 | /* jquery.Jcrop.css v0.9.12 - MIT License */ 2 | /* 3 | The outer-most container in a typical Jcrop instance 4 | If you are having difficulty with formatting related to styles 5 | on a parent element, place any fixes here or in a like selector 6 | 7 | You can also style this element if you want to add a border, etc 8 | A better method for styling can be seen below with .jcrop-light 9 | (Add a class to the holder and style elements for that extended class) 10 | */ 11 | .jcrop-holder { 12 | direction: ltr; 13 | text-align: left; 14 | } 15 | /* Selection Border */ 16 | .jcrop-vline, 17 | .jcrop-hline { 18 | background: #ffffff url("Jcrop.gif"); 19 | font-size: 0; 20 | position: absolute; 21 | } 22 | .jcrop-vline { 23 | height: 100%; 24 | width: 1px !important; 25 | } 26 | .jcrop-vline.right { 27 | right: 0; 28 | } 29 | .jcrop-hline { 30 | height: 1px !important; 31 | width: 100%; 32 | } 33 | .jcrop-hline.bottom { 34 | bottom: 0; 35 | } 36 | /* Invisible click targets */ 37 | .jcrop-tracker { 38 | height: 100%; 39 | width: 100%; 40 | /* "turn off" link highlight */ 41 | -webkit-tap-highlight-color: transparent; 42 | /* disable callout, image save panel */ 43 | -webkit-touch-callout: none; 44 | /* disable cut copy paste */ 45 | -webkit-user-select: none; 46 | } 47 | /* Selection Handles */ 48 | .jcrop-handle { 49 | background-color: #333333; 50 | border: 1px #eeeeee solid; 51 | width: 7px; 52 | height: 7px; 53 | font-size: 1px; 54 | } 55 | .jcrop-handle.ord-n { 56 | left: 50%; 57 | margin-left: -4px; 58 | margin-top: -4px; 59 | top: 0; 60 | } 61 | .jcrop-handle.ord-s { 62 | bottom: 0; 63 | left: 50%; 64 | margin-bottom: -4px; 65 | margin-left: -4px; 66 | } 67 | .jcrop-handle.ord-e { 68 | margin-right: -4px; 69 | margin-top: -4px; 70 | right: 0; 71 | top: 50%; 72 | } 73 | .jcrop-handle.ord-w { 74 | left: 0; 75 | margin-left: -4px; 76 | margin-top: -4px; 77 | top: 50%; 78 | } 79 | .jcrop-handle.ord-nw { 80 | left: 0; 81 | margin-left: -4px; 82 | margin-top: -4px; 83 | top: 0; 84 | } 85 | .jcrop-handle.ord-ne { 86 | margin-right: -4px; 87 | margin-top: -4px; 88 | right: 0; 89 | top: 0; 90 | } 91 | .jcrop-handle.ord-se { 92 | bottom: 0; 93 | margin-bottom: -4px; 94 | margin-right: -4px; 95 | right: 0; 96 | } 97 | .jcrop-handle.ord-sw { 98 | bottom: 0; 99 | left: 0; 100 | margin-bottom: -4px; 101 | margin-left: -4px; 102 | } 103 | /* Dragbars */ 104 | .jcrop-dragbar.ord-n, 105 | .jcrop-dragbar.ord-s { 106 | height: 7px; 107 | width: 100%; 108 | } 109 | .jcrop-dragbar.ord-e, 110 | .jcrop-dragbar.ord-w { 111 | height: 100%; 112 | width: 7px; 113 | } 114 | .jcrop-dragbar.ord-n { 115 | margin-top: -4px; 116 | } 117 | .jcrop-dragbar.ord-s { 118 | bottom: 0; 119 | margin-bottom: -4px; 120 | } 121 | .jcrop-dragbar.ord-e { 122 | margin-right: -4px; 123 | right: 0; 124 | } 125 | .jcrop-dragbar.ord-w { 126 | margin-left: -4px; 127 | } 128 | /* The "jcrop-light" class/extension */ 129 | .jcrop-light .jcrop-vline, 130 | .jcrop-light .jcrop-hline { 131 | background: #ffffff; 132 | filter: alpha(opacity=70) !important; 133 | opacity: .70!important; 134 | } 135 | .jcrop-light .jcrop-handle { 136 | -moz-border-radius: 3px; 137 | -webkit-border-radius: 3px; 138 | background-color: #000000; 139 | border-color: #ffffff; 140 | border-radius: 3px; 141 | } 142 | /* The "jcrop-dark" class/extension */ 143 | .jcrop-dark .jcrop-vline, 144 | .jcrop-dark .jcrop-hline { 145 | background: #000000; 146 | filter: alpha(opacity=70) !important; 147 | opacity: 0.7 !important; 148 | } 149 | .jcrop-dark .jcrop-handle { 150 | -moz-border-radius: 3px; 151 | -webkit-border-radius: 3px; 152 | background-color: #ffffff; 153 | border-color: #000000; 154 | border-radius: 3px; 155 | } 156 | /* Simple macro to turn off the antlines */ 157 | .solid-line .jcrop-vline, 158 | .solid-line .jcrop-hline { 159 | background: #ffffff; 160 | } 161 | /* Fix for twitter bootstrap et al. */ 162 | .jcrop-holder img, 163 | img.jcrop-preview { 164 | max-width: none; 165 | } 166 | 167 | /* Added my Reece Kenney */ 168 | * { 169 | -webkit-transition: all 0.0s ease-in-out; 170 | -moz-transition: all 0.0s ease-in-out; 171 | } 172 | -------------------------------------------------------------------------------- /assets/css/register_style.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Bellota-LightItalic'; 3 | src: url('../fonts/Bellota-LightItalic.otf'); 4 | } 5 | @font-face { 6 | font-family: 'Bellota-BoldItalic'; 7 | src: url('../fonts/Bellota-BoldItalic.otf'); 8 | } 9 | 10 | html, body { 11 | height: 100%; 12 | min-height: 100%; 13 | } 14 | 15 | form { 16 | text-align: center; 17 | } 18 | 19 | body{ 20 | margin: 0; 21 | padding: 0; 22 | } 23 | 24 | a { 25 | text-decoration: none; 26 | color: #3498db; 27 | } 28 | 29 | .wrapper { 30 | background-image: url("../images/backgrounds/desktop.jpg"); 31 | background-size: 100%; 32 | width: 100%; 33 | height: 100%; 34 | min-width: 950px; 35 | 36 | } 37 | 38 | .login_box { 39 | font-family: 'Bellota-LightItalic', sans-serif; 40 | position: relative; 41 | margin-right: auto; 42 | margin-left: auto; 43 | top: 7%; 44 | width: 55%; 45 | height: 75%; 46 | background-color: #ffffff; 47 | border: 1px solid #EDEDED; 48 | border-radius: 7px; 49 | padding: 5px; 50 | opacity: 0.98; 51 | } 52 | 53 | .login_header { 54 | font-family: 'baufra', sans-serif; 55 | width: 100%; 56 | height: 100px; 57 | background-color: orange; 58 | color: #fff; 59 | text-align: center; 60 | border-top-left-radius: 15px; 61 | border-top-right-radius: 7px; 62 | } 63 | 64 | .login_header h1 { 65 | font-family: 'catamaran', sans-serif; 66 | font-style: bold; 67 | margin-top: 0; 68 | margin-bottom: 0; 69 | color: #2C6C96; 70 | text-shadow: #73B6E2 0.5px 0.5px 0px; 71 | font-size: 350%; 72 | } 73 | 74 | input[type="submit"] { 75 | background-color: #3498db; 76 | border: 1px solid #3498db; 77 | border-radius: 7px; 78 | margin: 5px 0 10px 0; 79 | padding: 5px 10px 5px 10px; 80 | color: #2C6C96; 81 | text-shadow: #73B6E2 0.5px 0.5px 0px; 82 | font-family: 'Bellota-BoldItalic', sans-serif; 83 | font-size: 100%; 84 | } 85 | 86 | input[type="text"], input[type="email"], input[type="password"] { 87 | border: 1px solid #e5e5e5; 88 | margin-top: 5px; 89 | width: 70%; 90 | height: 45px; 91 | margin-bottom: 10px; 92 | padding-left: 5px; 93 | } 94 | 95 | input[type="text"]:hover, input[type="email"]:hover, input[type="password"]:hover { 96 | border-color: #3498db; 97 | } 98 | 99 | #second { 100 | display: none; 101 | } 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /assets/css/style.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Bellota-LightItalic'; 3 | src: url('../fonts/Bellota-LightItalic.otf'); 4 | } 5 | @font-face { 6 | font-family: 'Bellota-BoldItalic'; 7 | src: url('../fonts/Bellota-BoldItalic.otf'); 8 | } 9 | 10 | body { 11 | line-height: 17px; 12 | background-color: #E6EAE8; 13 | } 14 | 15 | a { 16 | color: #20AAE5; 17 | text-decoration: none; 18 | } 19 | 20 | .top_bar { 21 | width: 100%; 22 | min-width: 1050px; 23 | height: 40px; 24 | background-color: #2ecc71; 25 | border-bottom: 0.25em solid #efd45f; 26 | margin: 0 0 10px 0; 27 | display: inline-flex; 28 | position: fixed; 29 | z-index: 10; 30 | } 31 | .logo a{ 32 | font-family: 'aharoni', sans-serif; 33 | margin-left: 10px; 34 | font-size: 30; 35 | position: relative; 36 | top: 9px; 37 | text-shadow: #73B6E2 0.5px 0.5px 0px; 38 | color: #1086BA; 39 | } 40 | 41 | a:hover { 42 | text-decoration: none; 43 | } 44 | 45 | nav { 46 | float: right; 47 | right: 1px; 48 | position: absolute; 49 | margin: 10px; 50 | } 51 | 52 | nav a{ 53 | position: relative; 54 | color: #fff; 55 | text-decoration: none; 56 | font-size: 17px; 57 | } 58 | 59 | nav a:hover { 60 | border-bottom: 7px solid #e67e22; 61 | color: #fff; 62 | } 63 | 64 | .wrapper { 65 | margin: 0 auto; 66 | top: 50px; 67 | position: relative; 68 | padding: 0 10px; 69 | width: 75%; 70 | min-width: 950px; 71 | } 72 | 73 | .column { 74 | background-color: #fff; 75 | padding: 10px; 76 | border: 1px solid #D3D3D3; 77 | border-radius: 5px; 78 | box-shadow: 2px 2px 1px #D3D3D3; 79 | z-index: -1; 80 | color: #555; 81 | } 82 | 83 | .user_details { 84 | width: 250px; 85 | float: left; 86 | margin-bottom: 20px; 87 | } 88 | 89 | .user_details img { 90 | height: 120px; 91 | border-radius: 5px; 92 | margin-right: 5px; 93 | } 94 | 95 | .user_details_left_right { 96 | width: 120px; 97 | display: inline-table; 98 | position: absolute; 99 | } 100 | 101 | .main_column { 102 | float:right; 103 | width: 70%; 104 | z-index: -1; 105 | min-height: 170px; 106 | } 107 | 108 | .post_form { 109 | width: 100%; 110 | } 111 | 112 | .post_form textarea { 113 | width: 81%; 114 | height: 60px; 115 | border-radius: 3px; 116 | margin-right: 5px; 117 | border: 1px solid #D3D3D3; 118 | font-size: 12px; 119 | padding: 5px; 120 | } 121 | 122 | textarea:focus { 123 | outline: 0; 124 | } 125 | 126 | .post_form input[type="submit"] { 127 | width: 11%; 128 | height: 60px; 129 | border: none; 130 | border-radius: 3px; 131 | background-color: #3498db; 132 | font-family: 'Bellota-BoldItalic', sans-serif; 133 | color: #1E75CA; 134 | text-shadow: #73B6E2 0.5px 0.5px 0px; 135 | font-size: 90%; 136 | position: absolute; 137 | outline: 0; 138 | margin: 0; 139 | } 140 | 141 | .post_form input[type="submit"]:active { 142 | padding: 5px 4px 4px 5px; 143 | } 144 | 145 | .status_post { 146 | width: 96%; 147 | font-size: 15px; 148 | padding: 0px 5px; 149 | min-height: 75px; 150 | cursor:pointer; 151 | } 152 | 153 | .post_profile_pic { 154 | float: left; 155 | margin-right: 7px; 156 | } 157 | 158 | .post_profile_pic img { 159 | border-radius: 5px; 160 | } 161 | 162 | #comment_iframe { 163 | max-height: 250px; 164 | width: 100%; 165 | margin-top: 5px; 166 | } 167 | 168 | .comment_section { 169 | padding: 0 5px 5px 5px; 170 | } 171 | 172 | .comment_section img { 173 | margin: 0 3px 3px 3px; 174 | border-radius: 3px; 175 | } 176 | 177 | #comment_form textarea { 178 | border-color: #D3D3D3; 179 | width: 85%; 180 | height: 35px; 181 | border-radius: 5px; 182 | color: #616060; 183 | font-size: 14px; 184 | margin: 3px 3px 3px 5px; 185 | } 186 | #comment_form input[type="submit"] { 187 | border:none; 188 | background-color: #20AAE5; 189 | color: #156588; 190 | border-radius: 5px; 191 | width: 13%; 192 | height: 35px; 193 | margin-top: 3px; 194 | position: absolute; 195 | font-family: 'Bellota-BoldItalic', sans-serif; 196 | text-shadow: #73B6E2 0.5px 0.5px 0px; 197 | } 198 | 199 | .newsfeedPostOptions { 200 | padding: 0px; 201 | text-decoration: none; 202 | color:#20AAE5; 203 | border:none; 204 | } 205 | 206 | .newsfeedPostOptions iframe { 207 | border: 0px; 208 | height: 17px; 209 | width: 120px; 210 | } 211 | 212 | .comment_like { 213 | background-color: transparent; 214 | border: none; 215 | font-size: 14px; 216 | color: #3498db; 217 | padding: 0; 218 | height: auto; 219 | width: auto; 220 | margin: 0; 221 | } 222 | 223 | .like_value { 224 | display: inline; 225 | font-size: 14px; 226 | } 227 | 228 | .profile_left { 229 | top: -10px; 230 | width: 17%; 231 | max-width: 240px; 232 | min-width: 130px; 233 | height: 100%; 234 | float: left; 235 | position: relative; 236 | background-color: #37B0E9; 237 | border-right: 10px solid #83D6FE; 238 | color: #CBEAF8; 239 | margin-right: 20px; 240 | } 241 | 242 | .profile_left img { 243 | min-width: 80px; 244 | width: 55%; 245 | margin: 20px; 246 | border: 5px solid #83D6FE; 247 | border-radius: 100px; 248 | } 249 | 250 | .profile_info { 251 | display: list-item; 252 | background-color: #2980b9; 253 | width: 100%; 254 | padding: 10px 0 10px 0; 255 | } 256 | 257 | .profile_info p { 258 | margin: 0 0 0 20px; 259 | word-wrap: break-word; 260 | } 261 | 262 | .danger { 263 | background-color: #e74c3c; 264 | } 265 | .warning { 266 | background-color: #f0ad4e; 267 | } 268 | .default { 269 | background-color: #bdc3c7; 270 | } 271 | .success { 272 | background-color: #2ecc71; 273 | } 274 | .info { 275 | background-color: #3498db; 276 | } 277 | .deep_blue { 278 | background-color: #0043f0; 279 | } 280 | 281 | .profile_left input[type="submit"] { 282 | width: 90%; 283 | height: 30px; 284 | border-radius: 5px; 285 | margin: 7px 0 0 7px; 286 | border: none; 287 | color: #fff; 288 | } 289 | 290 | #accept_button { 291 | width: 20%; 292 | height: 28px; 293 | border-radius: 5px; 294 | margin: 5px; 295 | border: none; 296 | color: #fff; 297 | background-color: #2ecc71; 298 | } 299 | #ignore_button { 300 | width: 20%; 301 | height: 28px; 302 | border-radius: 5px; 303 | margin: 5px; 304 | border: none; 305 | color: #fff; 306 | background-color: #e74c3c; 307 | } 308 | 309 | .delete_button { 310 | height: 22px; 311 | width: 22px; 312 | padding: 0; 313 | float: right; 314 | border-radius: 4px; 315 | right: -15px; 316 | position: relative; 317 | } 318 | 319 | .profile_main_column { 320 | min-width: 675px; 321 | float: left; 322 | width: 70%; 323 | z-index: -1; 324 | 325 | } 326 | 327 | .profile_info_bottom { 328 | margin: 10 0 0 7px; 329 | 330 | } 331 | 332 | #message_textarea { 333 | width: 80%; 334 | margin-right: 8px; 335 | border-radius: 5px; 336 | border: 1px solid #D3D3D3; 337 | font-size: 12px; 338 | } 339 | #message_submit { 340 | height: 41px; 341 | width: 120px; 342 | margin: 0; 343 | position: absolute; 344 | border:none; 345 | background-color: #20AAE5; 346 | color: #156588; 347 | border-radius: 5px; 348 | font-family: 'Bellota-BoldItalic', sans-serif; 349 | text-shadow: #73B6E2 0.5px 0.5px 0px; 350 | } 351 | .message { 352 | border: 1px solid #000; 353 | border-radius: 5px; 354 | padding: 5px 10px; 355 | display: inline-block; 356 | color: #fff; 357 | } 358 | 359 | .message#blue { 360 | background-color: #3498db; 361 | border-color: #2980b9; 362 | float: right; 363 | margin-bottom: 5px; 364 | } 365 | .message#green { 366 | background-color: #2ecc71; 367 | border-color: #27ae60; 368 | float: left; 369 | margin-bottom: 5px; 370 | } 371 | 372 | .loaded_messages { 373 | height: 65%; 374 | min-height: 300px; 375 | max-height: 400px; 376 | overflow: scroll; 377 | margin-bottom: 10px; 378 | } 379 | 380 | .loaded_conversations { 381 | max-height: 216px; 382 | overflow: scroll; 383 | } 384 | 385 | .user_found_messages { 386 | border-bottom: 1px solid #D3D3D3; 387 | padding: 8px 8px 10px 8px; 388 | } 389 | 390 | .user_found_messages:hover { 391 | background-color: #D3D3D3; 392 | } 393 | 394 | .user_found_messages img { 395 | height: 35px; 396 | float: left; 397 | } 398 | 399 | #grey { 400 | color: #8C8C8C; 401 | } 402 | 403 | .resultDisplay { 404 | padding: 5px 5px 0 5px; 405 | height: 70px; 406 | border-bottom: 1px solid #D3D3D3; 407 | } 408 | .resultDisplay a { 409 | float: none; 410 | } 411 | .resultDisplay:hover { 412 | background-color: #EBEBEB; 413 | text-decoration: none; 414 | } 415 | .liveSearchProfilePic img { 416 | height: 50px; 417 | border-radius: 25px; 418 | margin: 1px 12px 0 2px; 419 | float: left; 420 | } 421 | 422 | .liveSearchText { 423 | background-color: transparent; 424 | color: #1E96CA; 425 | } 426 | 427 | .liveSearchText p{ 428 | margin-left: 10px; 429 | font-size: 12px; 430 | } 431 | 432 | .tab-content { 433 | margin-top: 25px; 434 | } 435 | 436 | .dropdown_data_window { 437 | background-color: #fff; 438 | border: 1px solid #DADADA; 439 | border-radius: 0 0 8px 8px; 440 | border-top: none; 441 | width: 300px; 442 | position: absolute; 443 | right: 10px; 444 | top: 40px; 445 | overflow: scroll; 446 | } 447 | 448 | .notification_badge { 449 | padding: 3px 7px; 450 | font-size: 12px; 451 | font-weight: 700; 452 | line-height: 1; 453 | color: #fff; 454 | text-align: center; 455 | white-space: nowrap; 456 | vertical-align: baseline; 457 | background-color: #F00; 458 | border-radius: 10px; 459 | position: absolute; 460 | left: 8px; 461 | top: -5px; 462 | } 463 | 464 | .resultDisplayNotification { 465 | height: auto; 466 | color: #1485BD; 467 | padding-bottom: 7px; 468 | } 469 | 470 | .resultDisplayNotification img { 471 | height: 40px; 472 | border-radius: 5px; 473 | margin: 1px 12px 0px 2px; 474 | float: left; 475 | } 476 | 477 | .timestamp_smaller { 478 | font-size: 85%; 479 | margin: 0; 480 | } 481 | 482 | .search { 483 | margin: 8px 0 0 15%; 484 | } 485 | 486 | .search #search_text_input { 487 | border: thin solid #E5E5E5; 488 | float: left; 489 | height: 23px; 490 | outline: 0; 491 | width: 100px; 492 | border-top-right-radius: 0; 493 | border-bottom-right-radius: 0; 494 | border-top-left-radius: 3px; 495 | border-bottom-left-radius: 3px; 496 | } 497 | 498 | .button_holder { 499 | background-color: #F1F1F1; 500 | border: thin solid #e5e5e5; 501 | cursor: pointer; 502 | float: left; 503 | height: 23px; 504 | text-align: center; 505 | width: 50px; 506 | border-top-right-radius: 3px; 507 | border-bottom-right-radius: 3px; 508 | } 509 | 510 | .button_holder img { 511 | margin-top: 1px; 512 | width: 20px; 513 | } 514 | 515 | .search_results { 516 | background-color: #fff; 517 | border: 1px solid #DADADA; 518 | border-bottom: none; 519 | border-top: none; 520 | margin-top: 21px; 521 | } 522 | 523 | .search_results_footer{ 524 | padding: 7px 4px 0px 4px; 525 | height: 30px; 526 | border: 1px solid #DADADA; 527 | border-top: none; 528 | background-color: #20AAE5; 529 | text-align: center; 530 | } 531 | 532 | .search_results_footer a { 533 | color: #fff; 534 | } 535 | 536 | .search_result { 537 | padding: 10px; 538 | height: 100px; 539 | } 540 | 541 | .searchPageFriendButtons { 542 | float: right; 543 | } 544 | 545 | .searchPageFriendButtons input[type="submit"] { 546 | border: none; 547 | padding: 7px 12px; 548 | border-radius: 5px; 549 | color: #fff; 550 | } 551 | 552 | .result_profile_pic { 553 | float: left; 554 | margin-right: 10px; 555 | } 556 | 557 | #search_hr { 558 | margin-bottom: 0px; 559 | } 560 | 561 | .small_profile_pic { 562 | height: 55px; 563 | margin: 1px 12px 0 2px; 564 | float: left; 565 | } 566 | 567 | #settings_input { 568 | border: 1px solid #ccc; 569 | height: 20px; 570 | padding: 4px 6px; 571 | margin-bottom: 10px; 572 | border-radius: 4px; 573 | font-size: 14px; 574 | line-height: 20px; 575 | } 576 | 577 | .settings_submit { 578 | border: none; 579 | padding: 7px 12px; 580 | border-radius: 5px; 581 | color: #fff; 582 | } 583 | 584 | 585 | .message .deleteButton { 586 | color: #fff; 587 | margin: 0 5px 5px 0; 588 | cursor: pointer; 589 | } 590 | 591 | .postedImage img { 592 | max-height: 300px; 593 | max-width: 100%; 594 | display: block; 595 | margin: 5px auto; 596 | } 597 | 598 | 599 | 600 | 601 | 602 | 603 | -------------------------------------------------------------------------------- /assets/fonts/Bellota-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/fonts/Bellota-Bold.otf -------------------------------------------------------------------------------- /assets/fonts/Bellota-BoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/fonts/Bellota-BoldItalic.otf -------------------------------------------------------------------------------- /assets/fonts/Bellota-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/fonts/Bellota-Italic.otf -------------------------------------------------------------------------------- /assets/fonts/Bellota-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/fonts/Bellota-Light.otf -------------------------------------------------------------------------------- /assets/fonts/Bellota-LightItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/fonts/Bellota-LightItalic.otf -------------------------------------------------------------------------------- /assets/fonts/Bellota-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/fonts/Bellota-Regular.otf -------------------------------------------------------------------------------- /assets/images/backgrounds/desktop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/backgrounds/desktop.jpg -------------------------------------------------------------------------------- /assets/images/icons/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/icons/loading.gif -------------------------------------------------------------------------------- /assets/images/icons/magnifying_glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/icons/magnifying_glass.png -------------------------------------------------------------------------------- /assets/images/posts/5947799f01421308Image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5947799f01421308Image.jpg -------------------------------------------------------------------------------- /assets/images/posts/59477a06cc889harrysImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/59477a06cc889harrysImage.jpg -------------------------------------------------------------------------------- /assets/images/posts/5bf807e59753dai.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf807e59753dai.jpeg -------------------------------------------------------------------------------- /assets/images/posts/5bf8234020124YASWANTH SAI PALAGHAT-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf8234020124YASWANTH SAI PALAGHAT-1.jpg -------------------------------------------------------------------------------- /assets/images/posts/5bf82353605a8YASWANTH SAI PALAGHAT-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf82353605a8YASWANTH SAI PALAGHAT-1.jpg -------------------------------------------------------------------------------- /assets/images/posts/5bf8235e383dcYASWANTH SAI PALAGHAT-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf8235e383dcYASWANTH SAI PALAGHAT-1.jpg -------------------------------------------------------------------------------- /assets/images/posts/5bf82d922d230YASWANTH SAI PALAGHAT (6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf82d922d230YASWANTH SAI PALAGHAT (6).png -------------------------------------------------------------------------------- /assets/images/posts/5bf830adb24adYASWANTH SAI PALAGHAT (6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf830adb24adYASWANTH SAI PALAGHAT (6).png -------------------------------------------------------------------------------- /assets/images/posts/5bf83105e99d6YASWANTH SAI PALAGHAT (6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf83105e99d6YASWANTH SAI PALAGHAT (6).png -------------------------------------------------------------------------------- /assets/images/posts/5bf83135d09d6YASWANTH SAI PALAGHAT (6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf83135d09d6YASWANTH SAI PALAGHAT (6).png -------------------------------------------------------------------------------- /assets/images/posts/5bf8314b63566YASWANTH SAI PALAGHAT (6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf8314b63566YASWANTH SAI PALAGHAT (6).png -------------------------------------------------------------------------------- /assets/images/posts/5bf8315795ff2YASWANTH SAI PALAGHAT (6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf8315795ff2YASWANTH SAI PALAGHAT (6).png -------------------------------------------------------------------------------- /assets/images/posts/5bf831750c46eYASWANTH SAI PALAGHAT (6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf831750c46eYASWANTH SAI PALAGHAT (6).png -------------------------------------------------------------------------------- /assets/images/posts/5bf8320ead1dfYASWANTH SAI PALAGHAT (6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf8320ead1dfYASWANTH SAI PALAGHAT (6).png -------------------------------------------------------------------------------- /assets/images/posts/5bf83abe789afai3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf83abe789afai3.jpg -------------------------------------------------------------------------------- /assets/images/posts/5bf83ac82e247ai3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf83ac82e247ai3.jpg -------------------------------------------------------------------------------- /assets/images/posts/5bf83acd30957ai3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bf83acd30957ai3.jpg -------------------------------------------------------------------------------- /assets/images/posts/5bfaf25c3f0acai.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/posts/5bfaf25c3f0acai.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/bart_simpson37e241c20f54539e5304221e3cdb301an.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/bart_simpson37e241c20f54539e5304221e3cdb301an.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/captain_america42ec2eed5d26bc70eacc842160a47a71n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/captain_america42ec2eed5d26bc70eacc842160a47a71n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_alizarin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_alizarin.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_amethyst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_amethyst.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_belize_hole.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_belize_hole.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_carrot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_carrot.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_deep_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_deep_blue.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_emerald.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_emerald.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_green_sea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_green_sea.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_nephritis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_nephritis.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_pete_river.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_pete_river.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_pomegranate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_pomegranate.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_pumpkin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_pumpkin.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_red.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_sun_flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_sun_flower.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_turqoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_turqoise.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_wet_asphalt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_wet_asphalt.png -------------------------------------------------------------------------------- /assets/images/profile_pics/defaults/head_wisteria.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/defaults/head_wisteria.png -------------------------------------------------------------------------------- /assets/images/profile_pics/goofy_mouse9ddceb032f4c9ad008be1aa646a18e94n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/goofy_mouse9ddceb032f4c9ad008be1aa646a18e94n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/goofy_mousef23548fb257c3489bd35e362e71203c8n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/goofy_mousef23548fb257c3489bd35e362e71203c8n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/homer_simpson411f23038880f46914f888ad170cdce0n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/homer_simpson411f23038880f46914f888ad170cdce0n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/homer_simpson96b166fee6674f498f207fdf9b7089c0n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/homer_simpson96b166fee6674f498f207fdf9b7089c0n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/little_mac9cfacd93b608dce648d5f43013e3c975n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/little_mac9cfacd93b608dce648d5f43013e3c975n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/reece_kenney_122c9660b9d1eedcaf99c04ab974cab44n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/reece_kenney_122c9660b9d1eedcaf99c04ab974cab44n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/reece_kenney_133159c4b4790562ba0ea8bdefde17261n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/reece_kenney_133159c4b4790562ba0ea8bdefde17261n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/yaswanth_palaghat47ec7ac91a34019876f060e9045ec9e5n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/yaswanth_palaghat47ec7ac91a34019876f060e9045ec9e5n.jpeg -------------------------------------------------------------------------------- /assets/images/profile_pics/yaswanth_palaghat92ed9d1a43632b6a58224c0e21ec70b3n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaswanthpalaghat/Social-Network-using-php-and-mysql/6b2a512b2c6d147b423c9d8f4997b7c97cd77c93/assets/images/profile_pics/yaswanth_palaghat92ed9d1a43632b6a58224c0e21ec70b3n.jpeg -------------------------------------------------------------------------------- /assets/js/bootbox.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * bootbox.js v4.4.0 3 | * 4 | * http://bootboxjs.com/license.txt 5 | */ 6 | !function(a,b){"use strict";"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.bootbox=b(a.jQuery)}(this,function a(b,c){"use strict";function d(a){var b=q[o.locale];return b?b[a]:q.en[a]}function e(a,c,d){a.stopPropagation(),a.preventDefault();var e=b.isFunction(d)&&d.call(c,a)===!1;e||c.modal("hide")}function f(a){var b,c=0;for(b in a)c++;return c}function g(a,c){var d=0;b.each(a,function(a,b){c(a,b,d++)})}function h(a){var c,d;if("object"!=typeof a)throw new Error("Please supply an object of options");if(!a.message)throw new Error("Please specify a message");return a=b.extend({},o,a),a.buttons||(a.buttons={}),c=a.buttons,d=f(c),g(c,function(a,e,f){if(b.isFunction(e)&&(e=c[a]={callback:e}),"object"!==b.type(e))throw new Error("button with key "+a+" must be an object");e.label||(e.label=a),e.className||(e.className=2>=d&&f===d-1?"btn-primary":"btn-default")}),a}function i(a,b){var c=a.length,d={};if(1>c||c>2)throw new Error("Invalid argument length");return 2===c||"string"==typeof a[0]?(d[b[0]]=a[0],d[b[1]]=a[1]):d=a[0],d}function j(a,c,d){return b.extend(!0,{},a,i(c,d))}function k(a,b,c,d){var e={className:"bootbox-"+a,buttons:l.apply(null,b)};return m(j(e,d,c),b)}function l(){for(var a={},b=0,c=arguments.length;c>b;b++){var e=arguments[b],f=e.toLowerCase(),g=e.toUpperCase();a[f]={label:d(g)}}return a}function m(a,b){var d={};return g(b,function(a,b){d[b]=!0}),g(a.buttons,function(a){if(d[a]===c)throw new Error("button key "+a+" is not allowed (options are "+b.join("\n")+")")}),a}var n={dialog:"",header:"",footer:"",closeButton:"",form:"
",inputs:{text:"",textarea:"",email:"",select:"",checkbox:"
",date:"",time:"",number:"",password:""}},o={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},p={};p.alert=function(){var a;if(a=k("alert",["ok"],["message","callback"],arguments),a.callback&&!b.isFunction(a.callback))throw new Error("alert requires callback property to be a function when provided");return a.buttons.ok.callback=a.onEscape=function(){return b.isFunction(a.callback)?a.callback.call(this):!0},p.dialog(a)},p.confirm=function(){var a;if(a=k("confirm",["cancel","confirm"],["message","callback"],arguments),a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,!1)},a.buttons.confirm.callback=function(){return a.callback.call(this,!0)},!b.isFunction(a.callback))throw new Error("confirm requires a callback");return p.dialog(a)},p.prompt=function(){var a,d,e,f,h,i,k;if(f=b(n.form),d={className:"bootbox-prompt",buttons:l("cancel","confirm"),value:"",inputType:"text"},a=m(j(d,arguments,["title","callback"]),["cancel","confirm"]),i=a.show===c?!0:a.show,a.message=f,a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,null)},a.buttons.confirm.callback=function(){var c;switch(a.inputType){case"text":case"textarea":case"email":case"select":case"date":case"time":case"number":case"password":c=h.val();break;case"checkbox":var d=h.find("input:checked");c=[],g(d,function(a,d){c.push(b(d).val())})}return a.callback.call(this,c)},a.show=!1,!a.title)throw new Error("prompt requires a title");if(!b.isFunction(a.callback))throw new Error("prompt requires a callback");if(!n.inputs[a.inputType])throw new Error("invalid prompt type");switch(h=b(n.inputs[a.inputType]),a.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":h.val(a.value);break;case"select":var o={};if(k=a.inputOptions||[],!b.isArray(k))throw new Error("Please pass an array of input options");if(!k.length)throw new Error("prompt with select requires options");g(k,function(a,d){var e=h;if(d.value===c||d.text===c)throw new Error("given options in wrong format");d.group&&(o[d.group]||(o[d.group]=b("").attr("label",d.group)),e=o[d.group]),e.append("")}),g(o,function(a,b){h.append(b)}),h.val(a.value);break;case"checkbox":var q=b.isArray(a.value)?a.value:[a.value];if(k=a.inputOptions||[],!k.length)throw new Error("prompt with checkbox requires options");if(!k[0].value||!k[0].text)throw new Error("given options in wrong format");h=b("
"),g(k,function(c,d){var e=b(n.inputs[a.inputType]);e.find("input").attr("value",d.value),e.find("label").append(d.text),g(q,function(a,b){b===d.value&&e.find("input").prop("checked",!0)}),h.append(e)})}return a.placeholder&&h.attr("placeholder",a.placeholder),a.pattern&&h.attr("pattern",a.pattern),a.maxlength&&h.attr("maxlength",a.maxlength),f.append(h),f.on("submit",function(a){a.preventDefault(),a.stopPropagation(),e.find(".btn-primary").click()}),e=p.dialog(a),e.off("shown.bs.modal"),e.on("shown.bs.modal",function(){h.focus()}),i===!0&&e.modal("show"),e},p.dialog=function(a){a=h(a);var d=b(n.dialog),f=d.find(".modal-dialog"),i=d.find(".modal-body"),j=a.buttons,k="",l={onEscape:a.onEscape};if(b.fn.modal===c)throw new Error("$.fn.modal is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details.");if(g(j,function(a,b){k+="",l[a]=b.callback}),i.find(".bootbox-body").html(a.message),a.animate===!0&&d.addClass("fade"),a.className&&d.addClass(a.className),"large"===a.size?f.addClass("modal-lg"):"small"===a.size&&f.addClass("modal-sm"),a.title&&i.before(n.header),a.closeButton){var m=b(n.closeButton);a.title?d.find(".modal-header").prepend(m):m.css("margin-top","-10px").prependTo(i)}return a.title&&d.find(".modal-title").html(a.title),k.length&&(i.after(n.footer),d.find(".modal-footer").html(k)),d.on("hidden.bs.modal",function(a){a.target===this&&d.remove()}),d.on("shown.bs.modal",function(){d.find(".btn-primary:first").focus()}),"static"!==a.backdrop&&d.on("click.dismiss.bs.modal",function(a){d.children(".modal-backdrop").length&&(a.currentTarget=d.children(".modal-backdrop").get(0)),a.target===a.currentTarget&&d.trigger("escape.close.bb")}),d.on("escape.close.bb",function(a){l.onEscape&&e(a,d,l.onEscape)}),d.on("click",".modal-footer button",function(a){var c=b(this).data("bb-handler");e(a,d,l[c])}),d.on("click",".bootbox-close-button",function(a){e(a,d,l.onEscape)}),d.on("keyup",function(a){27===a.which&&d.trigger("escape.close.bb")}),b(a.container).append(d),d.modal({backdrop:a.backdrop?"static":!1,keyboard:!1,show:!1}),a.show&&d.modal("show"),d},p.setDefaults=function(){var a={};2===arguments.length?a[arguments[0]]=arguments[1]:a=arguments[0],b.extend(o,a)},p.hideAll=function(){return b(".bootbox").modal("hide"),p};var q={bg_BG:{OK:"Ок",CANCEL:"Отказ",CONFIRM:"Потвърждавам"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},cs:{OK:"OK",CANCEL:"Zrušit",CONFIRM:"Potvrdit"},da:{OK:"OK",CANCEL:"Annuller",CONFIRM:"Accepter"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},el:{OK:"Εντάξει",CANCEL:"Ακύρωση",CONFIRM:"Επιβεβαίωση"},en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},et:{OK:"OK",CANCEL:"Katkesta",CONFIRM:"OK"},fa:{OK:"قبول",CANCEL:"لغو",CONFIRM:"تایید"},fi:{OK:"OK",CANCEL:"Peruuta",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},he:{OK:"אישור",CANCEL:"ביטול",CONFIRM:"אישור"},hu:{OK:"OK",CANCEL:"Mégsem",CONFIRM:"Megerősít"},hr:{OK:"OK",CANCEL:"Odustani",CONFIRM:"Potvrdi"},id:{OK:"OK",CANCEL:"Batal",CONFIRM:"OK"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"},ja:{OK:"OK",CANCEL:"キャンセル",CONFIRM:"確認"},lt:{OK:"Gerai",CANCEL:"Atšaukti",CONFIRM:"Patvirtinti"},lv:{OK:"Labi",CANCEL:"Atcelt",CONFIRM:"Apstiprināt"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},no:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},pl:{OK:"OK",CANCEL:"Anuluj",CONFIRM:"Potwierdź"},pt:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Confirmar"},ru:{OK:"OK",CANCEL:"Отмена",CONFIRM:"Применить"},sq:{OK:"OK",CANCEL:"Anulo",CONFIRM:"Prano"},sv:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},th:{OK:"ตกลง",CANCEL:"ยกเลิก",CONFIRM:"ยืนยัน"},tr:{OK:"Tamam",CANCEL:"İptal",CONFIRM:"Onayla"},zh_CN:{OK:"OK",CANCEL:"取消",CONFIRM:"确认"},zh_TW:{OK:"OK",CANCEL:"取消",CONFIRM:"確認"}};return p.addLocale=function(a,c){return b.each(["OK","CANCEL","CONFIRM"],function(a,b){if(!c[b])throw new Error("Please supply a translation for '"+b+"'")}),q[a]={OK:c.OK,CANCEL:c.CANCEL,CONFIRM:c.CONFIRM},p},p.removeLocale=function(a){return delete q[a],p},p.setLocale=function(a){return p.setDefaults("locale",a)},p.init=function(c){return a(c||b)},p}); -------------------------------------------------------------------------------- /assets/js/demo.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | $('#search_text_input').focus(function() { 4 | if(window.matchMedia( "(min-width: 800px)" ).matches) { 5 | $(this).animate({width: '250px'}, 500); 6 | } 7 | }); 8 | 9 | $('.button_holder').on('click', function() { 10 | document.search_form.submit(); 11 | }) 12 | 13 | //Button for profile post 14 | $('#submit_profile_post').click(function(){ 15 | 16 | $.ajax({ 17 | type: "POST", 18 | url: "includes/handlers/ajax_submit_profile_post.php", 19 | data: $('form.profile_post').serialize(), 20 | success: function(msg) { 21 | $("#post_form").modal('hide'); 22 | location.reload(); 23 | }, 24 | error: function() { 25 | alert('Failure'); 26 | } 27 | }); 28 | 29 | }); 30 | 31 | 32 | }); 33 | 34 | 35 | $(document).click(function(e){ 36 | 37 | if(e.target.class != "search_results" && e.target.id != "search_text_input") { 38 | 39 | $(".search_results").html(""); 40 | $('.search_results_footer').html(""); 41 | $('.search_results_footer').toggleClass("search_results_footer_empty"); 42 | $('.search_results_footer').toggleClass("search_results_footer"); 43 | } 44 | 45 | if(e.target.className != "dropdown_data_window") { 46 | 47 | $(".dropdown_data_window").html(""); 48 | $(".dropdown_data_window").css({"padding" : "0px", "height" : "0px"}); 49 | } 50 | 51 | 52 | }); 53 | 54 | function deleteMessage(messageId, element) { 55 | 56 | $.post("includes/handlers/ajax_delete_message.php", {id:messageId}, function(data) { 57 | $(element).closest(".message").text("Message deleted"); 58 | }); 59 | } 60 | 61 | function getUsers(value, user) { 62 | $.post("includes/handlers/ajax_friend_search.php", {query:value, userLoggedIn:user}, function(data) { 63 | $(".results").html(data); 64 | }); 65 | } 66 | 67 | function getDropdownData(user, type) { 68 | 69 | if($(".dropdown_data_window").css("height") == "0px") { 70 | 71 | var pageName; 72 | 73 | if(type == 'notification') { 74 | pageName = "ajax_load_notifications.php"; 75 | $("span").remove("#unread_notification"); 76 | } 77 | else if (type == 'message') { 78 | pageName = "ajax_load_messages.php"; 79 | $("span").remove("#unread_message"); 80 | } 81 | 82 | var ajaxreq = $.ajax({ 83 | url: "includes/handlers/" + pageName, 84 | type: "POST", 85 | data: "page=1&userLoggedIn=" + user, 86 | cache: false, 87 | 88 | success: function(response) { 89 | $(".dropdown_data_window").html(response); 90 | $(".dropdown_data_window").css({"padding" : "0px", "height": "280px", "border" : "1px solid #DADADA"}); 91 | $("#dropdown_data_type").val(type); 92 | } 93 | 94 | }); 95 | 96 | } 97 | else { 98 | $(".dropdown_data_window").html(""); 99 | $(".dropdown_data_window").css({"padding" : "0px", "height": "0px", "border" : "none"}); 100 | } 101 | 102 | } 103 | 104 | 105 | function getLiveSearchUsers(value, user) { 106 | 107 | $.post("includes/handlers/ajax_search.php", {query:value, userLoggedIn: user}, function(data) { 108 | 109 | if($(".search_results_footer_empty")[0]) { 110 | $(".search_results_footer_empty").toggleClass("search_results_footer"); 111 | $(".search_results_footer_empty").toggleClass("search_results_footer_empty"); 112 | } 113 | 114 | $('.search_results').html(data); 115 | $('.search_results_footer').html("See All Results"); 116 | 117 | if(data == "") { 118 | $('.search_results_footer').html(""); 119 | $('.search_results_footer').toggleClass("search_results_footer_empty"); 120 | $('.search_results_footer').toggleClass("search_results_footer"); 121 | } 122 | 123 | }); 124 | 125 | } 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /assets/js/jcrop_bits.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | 3 | $('#jcrop_target').Jcrop({ 4 | aspectRatio: 1, 5 | setSelect: [ 200,200,37,49 ], 6 | onSelect: updateCoords 7 | }); 8 | 9 | }); 10 | 11 | function updateCoords(c) 12 | { 13 | $('#x').val(c.x); 14 | $('#y').val(c.y); 15 | $('#w').val(c.w); 16 | $('#h').val(c.h); 17 | }; 18 | 19 | function checkCoords() 20 | { 21 | if (parseInt($('#w').val())) return true; 22 | alert('Please select a crop region then press submit.'); 23 | return false; 24 | }; 25 | //End JCrop Bits 26 | 27 | function cancelCrop(){ 28 | //Refresh page 29 | top.location = 'upload.php'; 30 | return false; 31 | } -------------------------------------------------------------------------------- /assets/js/jquery.Jcrop.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jquery.Jcrop.js v0.9.12 3 | * jQuery Image Cropping Plugin - released under MIT License 4 | * Author: Kelly Hallman 5 | * http://github.com/tapmodo/Jcrop 6 | * Copyright (c) 2008-2013 Tapmodo Interactive LLC {{{ 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | * 29 | * }}} 30 | */ 31 | 32 | (function ($) { 33 | 34 | $.Jcrop = function (obj, opt) { 35 | var options = $.extend({}, $.Jcrop.defaults), 36 | docOffset, 37 | _ua = navigator.userAgent.toLowerCase(), 38 | is_msie = /msie/.test(_ua), 39 | ie6mode = /msie [1-6]\./.test(_ua); 40 | 41 | // Internal Methods {{{ 42 | function px(n) { 43 | return Math.round(n) + 'px'; 44 | } 45 | function cssClass(cl) { 46 | return options.baseClass + '-' + cl; 47 | } 48 | function supportsColorFade() { 49 | return $.fx.step.hasOwnProperty('backgroundColor'); 50 | } 51 | function getPos(obj) //{{{ 52 | { 53 | var pos = $(obj).offset(); 54 | return [pos.left, pos.top]; 55 | } 56 | //}}} 57 | function mouseAbs(e) //{{{ 58 | { 59 | return [(e.pageX - docOffset[0]), (e.pageY - docOffset[1])]; 60 | } 61 | //}}} 62 | function setOptions(opt) //{{{ 63 | { 64 | if (typeof(opt) !== 'object') opt = {}; 65 | options = $.extend(options, opt); 66 | 67 | $.each(['onChange','onSelect','onRelease','onDblClick'],function(i,e) { 68 | if (typeof(options[e]) !== 'function') options[e] = function () {}; 69 | }); 70 | } 71 | //}}} 72 | function startDragMode(mode, pos, touch) //{{{ 73 | { 74 | docOffset = getPos($img); 75 | Tracker.setCursor(mode === 'move' ? mode : mode + '-resize'); 76 | 77 | if (mode === 'move') { 78 | return Tracker.activateHandlers(createMover(pos), doneSelect, touch); 79 | } 80 | 81 | var fc = Coords.getFixed(); 82 | var opp = oppLockCorner(mode); 83 | var opc = Coords.getCorner(oppLockCorner(opp)); 84 | 85 | Coords.setPressed(Coords.getCorner(opp)); 86 | Coords.setCurrent(opc); 87 | 88 | Tracker.activateHandlers(dragmodeHandler(mode, fc), doneSelect, touch); 89 | } 90 | //}}} 91 | function dragmodeHandler(mode, f) //{{{ 92 | { 93 | return function (pos) { 94 | if (!options.aspectRatio) { 95 | switch (mode) { 96 | case 'e': 97 | pos[1] = f.y2; 98 | break; 99 | case 'w': 100 | pos[1] = f.y2; 101 | break; 102 | case 'n': 103 | pos[0] = f.x2; 104 | break; 105 | case 's': 106 | pos[0] = f.x2; 107 | break; 108 | } 109 | } else { 110 | switch (mode) { 111 | case 'e': 112 | pos[1] = f.y + 1; 113 | break; 114 | case 'w': 115 | pos[1] = f.y + 1; 116 | break; 117 | case 'n': 118 | pos[0] = f.x + 1; 119 | break; 120 | case 's': 121 | pos[0] = f.x + 1; 122 | break; 123 | } 124 | } 125 | Coords.setCurrent(pos); 126 | Selection.update(); 127 | }; 128 | } 129 | //}}} 130 | function createMover(pos) //{{{ 131 | { 132 | var lloc = pos; 133 | KeyManager.watchKeys(); 134 | 135 | return function (pos) { 136 | Coords.moveOffset([pos[0] - lloc[0], pos[1] - lloc[1]]); 137 | lloc = pos; 138 | 139 | Selection.update(); 140 | }; 141 | } 142 | //}}} 143 | function oppLockCorner(ord) //{{{ 144 | { 145 | switch (ord) { 146 | case 'n': 147 | return 'sw'; 148 | case 's': 149 | return 'nw'; 150 | case 'e': 151 | return 'nw'; 152 | case 'w': 153 | return 'ne'; 154 | case 'ne': 155 | return 'sw'; 156 | case 'nw': 157 | return 'se'; 158 | case 'se': 159 | return 'nw'; 160 | case 'sw': 161 | return 'ne'; 162 | } 163 | } 164 | //}}} 165 | function createDragger(ord) //{{{ 166 | { 167 | return function (e) { 168 | if (options.disabled) { 169 | return false; 170 | } 171 | if ((ord === 'move') && !options.allowMove) { 172 | return false; 173 | } 174 | 175 | // Fix position of crop area when dragged the very first time. 176 | // Necessary when crop image is in a hidden element when page is loaded. 177 | docOffset = getPos($img); 178 | 179 | btndown = true; 180 | startDragMode(ord, mouseAbs(e)); 181 | e.stopPropagation(); 182 | e.preventDefault(); 183 | return false; 184 | }; 185 | } 186 | //}}} 187 | function presize($obj, w, h) //{{{ 188 | { 189 | var nw = $obj.width(), 190 | nh = $obj.height(); 191 | if ((nw > w) && w > 0) { 192 | nw = w; 193 | nh = (w / $obj.width()) * $obj.height(); 194 | } 195 | if ((nh > h) && h > 0) { 196 | nh = h; 197 | nw = (h / $obj.height()) * $obj.width(); 198 | } 199 | xscale = $obj.width() / nw; 200 | yscale = $obj.height() / nh; 201 | $obj.width(nw).height(nh); 202 | } 203 | //}}} 204 | function unscale(c) //{{{ 205 | { 206 | return { 207 | x: c.x * xscale, 208 | y: c.y * yscale, 209 | x2: c.x2 * xscale, 210 | y2: c.y2 * yscale, 211 | w: c.w * xscale, 212 | h: c.h * yscale 213 | }; 214 | } 215 | //}}} 216 | function doneSelect(pos) //{{{ 217 | { 218 | var c = Coords.getFixed(); 219 | if ((c.w > options.minSelect[0]) && (c.h > options.minSelect[1])) { 220 | Selection.enableHandles(); 221 | Selection.done(); 222 | } else { 223 | Selection.release(); 224 | } 225 | Tracker.setCursor(options.allowSelect ? 'crosshair' : 'default'); 226 | } 227 | //}}} 228 | function newSelection(e) //{{{ 229 | { 230 | if (options.disabled) { 231 | return false; 232 | } 233 | if (!options.allowSelect) { 234 | return false; 235 | } 236 | btndown = true; 237 | docOffset = getPos($img); 238 | Selection.disableHandles(); 239 | Tracker.setCursor('crosshair'); 240 | var pos = mouseAbs(e); 241 | Coords.setPressed(pos); 242 | Selection.update(); 243 | Tracker.activateHandlers(selectDrag, doneSelect, e.type.substring(0,5)==='touch'); 244 | KeyManager.watchKeys(); 245 | 246 | e.stopPropagation(); 247 | e.preventDefault(); 248 | return false; 249 | } 250 | //}}} 251 | function selectDrag(pos) //{{{ 252 | { 253 | Coords.setCurrent(pos); 254 | Selection.update(); 255 | } 256 | //}}} 257 | function newTracker() //{{{ 258 | { 259 | var trk = $('
').addClass(cssClass('tracker')); 260 | if (is_msie) { 261 | trk.css({ 262 | opacity: 0, 263 | backgroundColor: 'white' 264 | }); 265 | } 266 | return trk; 267 | } 268 | //}}} 269 | 270 | // }}} 271 | // Initialization {{{ 272 | // Sanitize some options {{{ 273 | if (typeof(obj) !== 'object') { 274 | obj = $(obj)[0]; 275 | } 276 | if (typeof(opt) !== 'object') { 277 | opt = {}; 278 | } 279 | // }}} 280 | setOptions(opt); 281 | // Initialize some jQuery objects {{{ 282 | // The values are SET on the image(s) for the interface 283 | // If the original image has any of these set, they will be reset 284 | // However, if you destroy() the Jcrop instance the original image's 285 | // character in the DOM will be as you left it. 286 | var img_css = { 287 | border: 'none', 288 | visibility: 'visible', 289 | margin: 0, 290 | padding: 0, 291 | position: 'absolute', 292 | top: 0, 293 | left: 0 294 | }; 295 | 296 | var $origimg = $(obj), 297 | img_mode = true; 298 | 299 | if (obj.tagName == 'IMG') { 300 | // Fix size of crop image. 301 | // Necessary when crop image is within a hidden element when page is loaded. 302 | if ($origimg[0].width != 0 && $origimg[0].height != 0) { 303 | // Obtain dimensions from contained img element. 304 | $origimg.width($origimg[0].width); 305 | $origimg.height($origimg[0].height); 306 | } else { 307 | // Obtain dimensions from temporary image in case the original is not loaded yet (e.g. IE 7.0). 308 | var tempImage = new Image(); 309 | tempImage.src = $origimg[0].src; 310 | $origimg.width(tempImage.width); 311 | $origimg.height(tempImage.height); 312 | } 313 | 314 | var $img = $origimg.clone().removeAttr('id').css(img_css).show(); 315 | 316 | $img.width($origimg.width()); 317 | $img.height($origimg.height()); 318 | $origimg.after($img).hide(); 319 | 320 | } else { 321 | $img = $origimg.css(img_css).show(); 322 | img_mode = false; 323 | if (options.shade === null) { options.shade = true; } 324 | } 325 | 326 | presize($img, options.boxWidth, options.boxHeight); 327 | 328 | var boundx = $img.width(), 329 | boundy = $img.height(), 330 | 331 | 332 | $div = $('
').width(boundx).height(boundy).addClass(cssClass('holder')).css({ 333 | position: 'relative', 334 | backgroundColor: options.bgColor 335 | }).insertAfter($origimg).append($img); 336 | 337 | if (options.addClass) { 338 | $div.addClass(options.addClass); 339 | } 340 | 341 | var $img2 = $('
'), 342 | 343 | $img_holder = $('
') 344 | .width('100%').height('100%').css({ 345 | zIndex: 310, 346 | position: 'absolute', 347 | overflow: 'hidden' 348 | }), 349 | 350 | $hdl_holder = $('
') 351 | .width('100%').height('100%').css('zIndex', 320), 352 | 353 | $sel = $('
') 354 | .css({ 355 | position: 'absolute', 356 | zIndex: 600 357 | }).dblclick(function(){ 358 | var c = Coords.getFixed(); 359 | options.onDblClick.call(api,c); 360 | }).insertBefore($img).append($img_holder, $hdl_holder); 361 | 362 | if (img_mode) { 363 | 364 | $img2 = $('') 365 | .attr('src', $img.attr('src')).css(img_css).width(boundx).height(boundy), 366 | 367 | $img_holder.append($img2); 368 | 369 | } 370 | 371 | if (ie6mode) { 372 | $sel.css({ 373 | overflowY: 'hidden' 374 | }); 375 | } 376 | 377 | var bound = options.boundary; 378 | var $trk = newTracker().width(boundx + (bound * 2)).height(boundy + (bound * 2)).css({ 379 | position: 'absolute', 380 | top: px(-bound), 381 | left: px(-bound), 382 | zIndex: 290 383 | }).mousedown(newSelection); 384 | 385 | /* }}} */ 386 | // Set more variables {{{ 387 | var bgcolor = options.bgColor, 388 | bgopacity = options.bgOpacity, 389 | xlimit, ylimit, xmin, ymin, xscale, yscale, enabled = true, 390 | btndown, animating, shift_down; 391 | 392 | docOffset = getPos($img); 393 | // }}} 394 | // }}} 395 | // Internal Modules {{{ 396 | // Touch Module {{{ 397 | var Touch = (function () { 398 | // Touch support detection function adapted (under MIT License) 399 | // from code by Jeffrey Sambells - http://github.com/iamamused/ 400 | function hasTouchSupport() { 401 | var support = {}, events = ['touchstart', 'touchmove', 'touchend'], 402 | el = document.createElement('div'), i; 403 | 404 | try { 405 | for(i=0; i x1 + ox) { 491 | ox -= ox + x1; 492 | } 493 | if (0 > y1 + oy) { 494 | oy -= oy + y1; 495 | } 496 | 497 | if (boundy < y2 + oy) { 498 | oy += boundy - (y2 + oy); 499 | } 500 | if (boundx < x2 + ox) { 501 | ox += boundx - (x2 + ox); 502 | } 503 | 504 | x1 += ox; 505 | x2 += ox; 506 | y1 += oy; 507 | y2 += oy; 508 | } 509 | //}}} 510 | function getCorner(ord) //{{{ 511 | { 512 | var c = getFixed(); 513 | switch (ord) { 514 | case 'ne': 515 | return [c.x2, c.y]; 516 | case 'nw': 517 | return [c.x, c.y]; 518 | case 'se': 519 | return [c.x2, c.y2]; 520 | case 'sw': 521 | return [c.x, c.y2]; 522 | } 523 | } 524 | //}}} 525 | function getFixed() //{{{ 526 | { 527 | if (!options.aspectRatio) { 528 | return getRect(); 529 | } 530 | // This function could use some optimization I think... 531 | var aspect = options.aspectRatio, 532 | min_x = options.minSize[0] / xscale, 533 | 534 | 535 | //min_y = options.minSize[1]/yscale, 536 | max_x = options.maxSize[0] / xscale, 537 | max_y = options.maxSize[1] / yscale, 538 | rw = x2 - x1, 539 | rh = y2 - y1, 540 | rwa = Math.abs(rw), 541 | rha = Math.abs(rh), 542 | real_ratio = rwa / rha, 543 | xx, yy, w, h; 544 | 545 | if (max_x === 0) { 546 | max_x = boundx * 10; 547 | } 548 | if (max_y === 0) { 549 | max_y = boundy * 10; 550 | } 551 | if (real_ratio < aspect) { 552 | yy = y2; 553 | w = rha * aspect; 554 | xx = rw < 0 ? x1 - w : w + x1; 555 | 556 | if (xx < 0) { 557 | xx = 0; 558 | h = Math.abs((xx - x1) / aspect); 559 | yy = rh < 0 ? y1 - h : h + y1; 560 | } else if (xx > boundx) { 561 | xx = boundx; 562 | h = Math.abs((xx - x1) / aspect); 563 | yy = rh < 0 ? y1 - h : h + y1; 564 | } 565 | } else { 566 | xx = x2; 567 | h = rwa / aspect; 568 | yy = rh < 0 ? y1 - h : y1 + h; 569 | if (yy < 0) { 570 | yy = 0; 571 | w = Math.abs((yy - y1) * aspect); 572 | xx = rw < 0 ? x1 - w : w + x1; 573 | } else if (yy > boundy) { 574 | yy = boundy; 575 | w = Math.abs(yy - y1) * aspect; 576 | xx = rw < 0 ? x1 - w : w + x1; 577 | } 578 | } 579 | 580 | // Magic %-) 581 | if (xx > x1) { // right side 582 | if (xx - x1 < min_x) { 583 | xx = x1 + min_x; 584 | } else if (xx - x1 > max_x) { 585 | xx = x1 + max_x; 586 | } 587 | if (yy > y1) { 588 | yy = y1 + (xx - x1) / aspect; 589 | } else { 590 | yy = y1 - (xx - x1) / aspect; 591 | } 592 | } else if (xx < x1) { // left side 593 | if (x1 - xx < min_x) { 594 | xx = x1 - min_x; 595 | } else if (x1 - xx > max_x) { 596 | xx = x1 - max_x; 597 | } 598 | if (yy > y1) { 599 | yy = y1 + (x1 - xx) / aspect; 600 | } else { 601 | yy = y1 - (x1 - xx) / aspect; 602 | } 603 | } 604 | 605 | if (xx < 0) { 606 | x1 -= xx; 607 | xx = 0; 608 | } else if (xx > boundx) { 609 | x1 -= xx - boundx; 610 | xx = boundx; 611 | } 612 | 613 | if (yy < 0) { 614 | y1 -= yy; 615 | yy = 0; 616 | } else if (yy > boundy) { 617 | y1 -= yy - boundy; 618 | yy = boundy; 619 | } 620 | 621 | return makeObj(flipCoords(x1, y1, xx, yy)); 622 | } 623 | //}}} 624 | function rebound(p) //{{{ 625 | { 626 | if (p[0] < 0) p[0] = 0; 627 | if (p[1] < 0) p[1] = 0; 628 | 629 | if (p[0] > boundx) p[0] = boundx; 630 | if (p[1] > boundy) p[1] = boundy; 631 | 632 | return [Math.round(p[0]), Math.round(p[1])]; 633 | } 634 | //}}} 635 | function flipCoords(x1, y1, x2, y2) //{{{ 636 | { 637 | var xa = x1, 638 | xb = x2, 639 | ya = y1, 640 | yb = y2; 641 | if (x2 < x1) { 642 | xa = x2; 643 | xb = x1; 644 | } 645 | if (y2 < y1) { 646 | ya = y2; 647 | yb = y1; 648 | } 649 | return [xa, ya, xb, yb]; 650 | } 651 | //}}} 652 | function getRect() //{{{ 653 | { 654 | var xsize = x2 - x1, 655 | ysize = y2 - y1, 656 | delta; 657 | 658 | if (xlimit && (Math.abs(xsize) > xlimit)) { 659 | x2 = (xsize > 0) ? (x1 + xlimit) : (x1 - xlimit); 660 | } 661 | if (ylimit && (Math.abs(ysize) > ylimit)) { 662 | y2 = (ysize > 0) ? (y1 + ylimit) : (y1 - ylimit); 663 | } 664 | 665 | if (ymin / yscale && (Math.abs(ysize) < ymin / yscale)) { 666 | y2 = (ysize > 0) ? (y1 + ymin / yscale) : (y1 - ymin / yscale); 667 | } 668 | if (xmin / xscale && (Math.abs(xsize) < xmin / xscale)) { 669 | x2 = (xsize > 0) ? (x1 + xmin / xscale) : (x1 - xmin / xscale); 670 | } 671 | 672 | if (x1 < 0) { 673 | x2 -= x1; 674 | x1 -= x1; 675 | } 676 | if (y1 < 0) { 677 | y2 -= y1; 678 | y1 -= y1; 679 | } 680 | if (x2 < 0) { 681 | x1 -= x2; 682 | x2 -= x2; 683 | } 684 | if (y2 < 0) { 685 | y1 -= y2; 686 | y2 -= y2; 687 | } 688 | if (x2 > boundx) { 689 | delta = x2 - boundx; 690 | x1 -= delta; 691 | x2 -= delta; 692 | } 693 | if (y2 > boundy) { 694 | delta = y2 - boundy; 695 | y1 -= delta; 696 | y2 -= delta; 697 | } 698 | if (x1 > boundx) { 699 | delta = x1 - boundy; 700 | y2 -= delta; 701 | y1 -= delta; 702 | } 703 | if (y1 > boundy) { 704 | delta = y1 - boundy; 705 | y2 -= delta; 706 | y1 -= delta; 707 | } 708 | 709 | return makeObj(flipCoords(x1, y1, x2, y2)); 710 | } 711 | //}}} 712 | function makeObj(a) //{{{ 713 | { 714 | return { 715 | x: a[0], 716 | y: a[1], 717 | x2: a[2], 718 | y2: a[3], 719 | w: a[2] - a[0], 720 | h: a[3] - a[1] 721 | }; 722 | } 723 | //}}} 724 | 725 | return { 726 | flipCoords: flipCoords, 727 | setPressed: setPressed, 728 | setCurrent: setCurrent, 729 | getOffset: getOffset, 730 | moveOffset: moveOffset, 731 | getCorner: getCorner, 732 | getFixed: getFixed 733 | }; 734 | }()); 735 | 736 | //}}} 737 | // Shade Module {{{ 738 | var Shade = (function() { 739 | var enabled = false, 740 | holder = $('
').css({ 741 | position: 'absolute', 742 | zIndex: 240, 743 | opacity: 0 744 | }), 745 | shades = { 746 | top: createShade(), 747 | left: createShade().height(boundy), 748 | right: createShade().height(boundy), 749 | bottom: createShade() 750 | }; 751 | 752 | function resizeShades(w,h) { 753 | shades.left.css({ height: px(h) }); 754 | shades.right.css({ height: px(h) }); 755 | } 756 | function updateAuto() 757 | { 758 | return updateShade(Coords.getFixed()); 759 | } 760 | function updateShade(c) 761 | { 762 | shades.top.css({ 763 | left: px(c.x), 764 | width: px(c.w), 765 | height: px(c.y) 766 | }); 767 | shades.bottom.css({ 768 | top: px(c.y2), 769 | left: px(c.x), 770 | width: px(c.w), 771 | height: px(boundy-c.y2) 772 | }); 773 | shades.right.css({ 774 | left: px(c.x2), 775 | width: px(boundx-c.x2) 776 | }); 777 | shades.left.css({ 778 | width: px(c.x) 779 | }); 780 | } 781 | function createShade() { 782 | return $('
').css({ 783 | position: 'absolute', 784 | backgroundColor: options.shadeColor||options.bgColor 785 | }).appendTo(holder); 786 | } 787 | function enableShade() { 788 | if (!enabled) { 789 | enabled = true; 790 | holder.insertBefore($img); 791 | updateAuto(); 792 | Selection.setBgOpacity(1,0,1); 793 | $img2.hide(); 794 | 795 | setBgColor(options.shadeColor||options.bgColor,1); 796 | if (Selection.isAwake()) 797 | { 798 | setOpacity(options.bgOpacity,1); 799 | } 800 | else setOpacity(1,1); 801 | } 802 | } 803 | function setBgColor(color,now) { 804 | colorChangeMacro(getShades(),color,now); 805 | } 806 | function disableShade() { 807 | if (enabled) { 808 | holder.remove(); 809 | $img2.show(); 810 | enabled = false; 811 | if (Selection.isAwake()) { 812 | Selection.setBgOpacity(options.bgOpacity,1,1); 813 | } else { 814 | Selection.setBgOpacity(1,1,1); 815 | Selection.disableHandles(); 816 | } 817 | colorChangeMacro($div,0,1); 818 | } 819 | } 820 | function setOpacity(opacity,now) { 821 | if (enabled) { 822 | if (options.bgFade && !now) { 823 | holder.animate({ 824 | opacity: 1-opacity 825 | },{ 826 | queue: false, 827 | duration: options.fadeTime 828 | }); 829 | } 830 | else holder.css({opacity:1-opacity}); 831 | } 832 | } 833 | function refreshAll() { 834 | options.shade ? enableShade() : disableShade(); 835 | if (Selection.isAwake()) setOpacity(options.bgOpacity); 836 | } 837 | function getShades() { 838 | return holder.children(); 839 | } 840 | 841 | return { 842 | update: updateAuto, 843 | updateRaw: updateShade, 844 | getShades: getShades, 845 | setBgColor: setBgColor, 846 | enable: enableShade, 847 | disable: disableShade, 848 | resize: resizeShades, 849 | refresh: refreshAll, 850 | opacity: setOpacity 851 | }; 852 | }()); 853 | // }}} 854 | // Selection Module {{{ 855 | var Selection = (function () { 856 | var awake, 857 | hdep = 370, 858 | borders = {}, 859 | handle = {}, 860 | dragbar = {}, 861 | seehandles = false; 862 | 863 | // Private Methods 864 | function insertBorder(type) //{{{ 865 | { 866 | var jq = $('
').css({ 867 | position: 'absolute', 868 | opacity: options.borderOpacity 869 | }).addClass(cssClass(type)); 870 | $img_holder.append(jq); 871 | return jq; 872 | } 873 | //}}} 874 | function dragDiv(ord, zi) //{{{ 875 | { 876 | var jq = $('
').mousedown(createDragger(ord)).css({ 877 | cursor: ord + '-resize', 878 | position: 'absolute', 879 | zIndex: zi 880 | }).addClass('ord-'+ord); 881 | 882 | if (Touch.support) { 883 | jq.bind('touchstart.jcrop', Touch.createDragger(ord)); 884 | } 885 | 886 | $hdl_holder.append(jq); 887 | return jq; 888 | } 889 | //}}} 890 | function insertHandle(ord) //{{{ 891 | { 892 | var hs = options.handleSize, 893 | 894 | div = dragDiv(ord, hdep++).css({ 895 | opacity: options.handleOpacity 896 | }).addClass(cssClass('handle')); 897 | 898 | if (hs) { div.width(hs).height(hs); } 899 | 900 | return div; 901 | } 902 | //}}} 903 | function insertDragbar(ord) //{{{ 904 | { 905 | return dragDiv(ord, hdep++).addClass('jcrop-dragbar'); 906 | } 907 | //}}} 908 | function createDragbars(li) //{{{ 909 | { 910 | var i; 911 | for (i = 0; i < li.length; i++) { 912 | dragbar[li[i]] = insertDragbar(li[i]); 913 | } 914 | } 915 | //}}} 916 | function createBorders(li) //{{{ 917 | { 918 | var cl,i; 919 | for (i = 0; i < li.length; i++) { 920 | switch(li[i]){ 921 | case'n': cl='hline'; break; 922 | case's': cl='hline bottom'; break; 923 | case'e': cl='vline right'; break; 924 | case'w': cl='vline'; break; 925 | } 926 | borders[li[i]] = insertBorder(cl); 927 | } 928 | } 929 | //}}} 930 | function createHandles(li) //{{{ 931 | { 932 | var i; 933 | for (i = 0; i < li.length; i++) { 934 | handle[li[i]] = insertHandle(li[i]); 935 | } 936 | } 937 | //}}} 938 | function moveto(x, y) //{{{ 939 | { 940 | if (!options.shade) { 941 | $img2.css({ 942 | top: px(-y), 943 | left: px(-x) 944 | }); 945 | } 946 | $sel.css({ 947 | top: px(y), 948 | left: px(x) 949 | }); 950 | } 951 | //}}} 952 | function resize(w, h) //{{{ 953 | { 954 | $sel.width(Math.round(w)).height(Math.round(h)); 955 | } 956 | //}}} 957 | function refresh() //{{{ 958 | { 959 | var c = Coords.getFixed(); 960 | 961 | Coords.setPressed([c.x, c.y]); 962 | Coords.setCurrent([c.x2, c.y2]); 963 | 964 | updateVisible(); 965 | } 966 | //}}} 967 | 968 | // Internal Methods 969 | function updateVisible(select) //{{{ 970 | { 971 | if (awake) { 972 | return update(select); 973 | } 974 | } 975 | //}}} 976 | function update(select) //{{{ 977 | { 978 | var c = Coords.getFixed(); 979 | 980 | resize(c.w, c.h); 981 | moveto(c.x, c.y); 982 | if (options.shade) Shade.updateRaw(c); 983 | 984 | awake || show(); 985 | 986 | if (select) { 987 | options.onSelect.call(api, unscale(c)); 988 | } else { 989 | options.onChange.call(api, unscale(c)); 990 | } 991 | } 992 | //}}} 993 | function setBgOpacity(opacity,force,now) //{{{ 994 | { 995 | if (!awake && !force) return; 996 | if (options.bgFade && !now) { 997 | $img.animate({ 998 | opacity: opacity 999 | },{ 1000 | queue: false, 1001 | duration: options.fadeTime 1002 | }); 1003 | } else { 1004 | $img.css('opacity', opacity); 1005 | } 1006 | } 1007 | //}}} 1008 | function show() //{{{ 1009 | { 1010 | $sel.show(); 1011 | 1012 | if (options.shade) Shade.opacity(bgopacity); 1013 | else setBgOpacity(bgopacity,true); 1014 | 1015 | awake = true; 1016 | } 1017 | //}}} 1018 | function release() //{{{ 1019 | { 1020 | disableHandles(); 1021 | $sel.hide(); 1022 | 1023 | if (options.shade) Shade.opacity(1); 1024 | else setBgOpacity(1); 1025 | 1026 | awake = false; 1027 | options.onRelease.call(api); 1028 | } 1029 | //}}} 1030 | function showHandles() //{{{ 1031 | { 1032 | if (seehandles) { 1033 | $hdl_holder.show(); 1034 | } 1035 | } 1036 | //}}} 1037 | function enableHandles() //{{{ 1038 | { 1039 | seehandles = true; 1040 | if (options.allowResize) { 1041 | $hdl_holder.show(); 1042 | return true; 1043 | } 1044 | } 1045 | //}}} 1046 | function disableHandles() //{{{ 1047 | { 1048 | seehandles = false; 1049 | $hdl_holder.hide(); 1050 | } 1051 | //}}} 1052 | function animMode(v) //{{{ 1053 | { 1054 | if (v) { 1055 | animating = true; 1056 | disableHandles(); 1057 | } else { 1058 | animating = false; 1059 | enableHandles(); 1060 | } 1061 | } 1062 | //}}} 1063 | function done() //{{{ 1064 | { 1065 | animMode(false); 1066 | refresh(); 1067 | } 1068 | //}}} 1069 | // Insert draggable elements {{{ 1070 | // Insert border divs for outline 1071 | 1072 | if (options.dragEdges && $.isArray(options.createDragbars)) 1073 | createDragbars(options.createDragbars); 1074 | 1075 | if ($.isArray(options.createHandles)) 1076 | createHandles(options.createHandles); 1077 | 1078 | if (options.drawBorders && $.isArray(options.createBorders)) 1079 | createBorders(options.createBorders); 1080 | 1081 | //}}} 1082 | 1083 | // This is a hack for iOS5 to support drag/move touch functionality 1084 | $(document).bind('touchstart.jcrop-ios',function(e) { 1085 | if ($(e.currentTarget).hasClass('jcrop-tracker')) e.stopPropagation(); 1086 | }); 1087 | 1088 | var $track = newTracker().mousedown(createDragger('move')).css({ 1089 | cursor: 'move', 1090 | position: 'absolute', 1091 | zIndex: 360 1092 | }); 1093 | 1094 | if (Touch.support) { 1095 | $track.bind('touchstart.jcrop', Touch.createDragger('move')); 1096 | } 1097 | 1098 | $img_holder.append($track); 1099 | disableHandles(); 1100 | 1101 | return { 1102 | updateVisible: updateVisible, 1103 | update: update, 1104 | release: release, 1105 | refresh: refresh, 1106 | isAwake: function () { 1107 | return awake; 1108 | }, 1109 | setCursor: function (cursor) { 1110 | $track.css('cursor', cursor); 1111 | }, 1112 | enableHandles: enableHandles, 1113 | enableOnly: function () { 1114 | seehandles = true; 1115 | }, 1116 | showHandles: showHandles, 1117 | disableHandles: disableHandles, 1118 | animMode: animMode, 1119 | setBgOpacity: setBgOpacity, 1120 | done: done 1121 | }; 1122 | }()); 1123 | 1124 | //}}} 1125 | // Tracker Module {{{ 1126 | var Tracker = (function () { 1127 | var onMove = function () {}, 1128 | onDone = function () {}, 1129 | trackDoc = options.trackDocument; 1130 | 1131 | function toFront(touch) //{{{ 1132 | { 1133 | $trk.css({ 1134 | zIndex: 450 1135 | }); 1136 | 1137 | if (touch) 1138 | $(document) 1139 | .bind('touchmove.jcrop', trackTouchMove) 1140 | .bind('touchend.jcrop', trackTouchEnd); 1141 | 1142 | else if (trackDoc) 1143 | $(document) 1144 | .bind('mousemove.jcrop',trackMove) 1145 | .bind('mouseup.jcrop',trackUp); 1146 | } 1147 | //}}} 1148 | function toBack() //{{{ 1149 | { 1150 | $trk.css({ 1151 | zIndex: 290 1152 | }); 1153 | $(document).unbind('.jcrop'); 1154 | } 1155 | //}}} 1156 | function trackMove(e) //{{{ 1157 | { 1158 | onMove(mouseAbs(e)); 1159 | return false; 1160 | } 1161 | //}}} 1162 | function trackUp(e) //{{{ 1163 | { 1164 | e.preventDefault(); 1165 | e.stopPropagation(); 1166 | 1167 | if (btndown) { 1168 | btndown = false; 1169 | 1170 | onDone(mouseAbs(e)); 1171 | 1172 | if (Selection.isAwake()) { 1173 | options.onSelect.call(api, unscale(Coords.getFixed())); 1174 | } 1175 | 1176 | toBack(); 1177 | onMove = function () {}; 1178 | onDone = function () {}; 1179 | } 1180 | 1181 | return false; 1182 | } 1183 | //}}} 1184 | function activateHandlers(move, done, touch) //{{{ 1185 | { 1186 | btndown = true; 1187 | onMove = move; 1188 | onDone = done; 1189 | toFront(touch); 1190 | return false; 1191 | } 1192 | //}}} 1193 | function trackTouchMove(e) //{{{ 1194 | { 1195 | onMove(mouseAbs(Touch.cfilter(e))); 1196 | return false; 1197 | } 1198 | //}}} 1199 | function trackTouchEnd(e) //{{{ 1200 | { 1201 | return trackUp(Touch.cfilter(e)); 1202 | } 1203 | //}}} 1204 | function setCursor(t) //{{{ 1205 | { 1206 | $trk.css('cursor', t); 1207 | } 1208 | //}}} 1209 | 1210 | if (!trackDoc) { 1211 | $trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp); 1212 | } 1213 | 1214 | $img.before($trk); 1215 | return { 1216 | activateHandlers: activateHandlers, 1217 | setCursor: setCursor 1218 | }; 1219 | }()); 1220 | //}}} 1221 | // KeyManager Module {{{ 1222 | var KeyManager = (function () { 1223 | var $keymgr = $('').css({ 1224 | position: 'fixed', 1225 | left: '-120px', 1226 | width: '12px' 1227 | }).addClass('jcrop-keymgr'), 1228 | 1229 | $keywrap = $('
').css({ 1230 | position: 'absolute', 1231 | overflow: 'hidden' 1232 | }).append($keymgr); 1233 | 1234 | function watchKeys() //{{{ 1235 | { 1236 | if (options.keySupport) { 1237 | $keymgr.show(); 1238 | $keymgr.focus(); 1239 | } 1240 | } 1241 | //}}} 1242 | function onBlur(e) //{{{ 1243 | { 1244 | $keymgr.hide(); 1245 | } 1246 | //}}} 1247 | function doNudge(e, x, y) //{{{ 1248 | { 1249 | if (options.allowMove) { 1250 | Coords.moveOffset([x, y]); 1251 | Selection.updateVisible(true); 1252 | } 1253 | e.preventDefault(); 1254 | e.stopPropagation(); 1255 | } 1256 | //}}} 1257 | function parseKey(e) //{{{ 1258 | { 1259 | if (e.ctrlKey || e.metaKey) { 1260 | return true; 1261 | } 1262 | shift_down = e.shiftKey ? true : false; 1263 | var nudge = shift_down ? 10 : 1; 1264 | 1265 | switch (e.keyCode) { 1266 | case 37: 1267 | doNudge(e, -nudge, 0); 1268 | break; 1269 | case 39: 1270 | doNudge(e, nudge, 0); 1271 | break; 1272 | case 38: 1273 | doNudge(e, 0, -nudge); 1274 | break; 1275 | case 40: 1276 | doNudge(e, 0, nudge); 1277 | break; 1278 | case 27: 1279 | if (options.allowSelect) Selection.release(); 1280 | break; 1281 | case 9: 1282 | return true; 1283 | } 1284 | 1285 | return false; 1286 | } 1287 | //}}} 1288 | 1289 | if (options.keySupport) { 1290 | $keymgr.keydown(parseKey).blur(onBlur); 1291 | if (ie6mode || !options.fixedSupport) { 1292 | $keymgr.css({ 1293 | position: 'absolute', 1294 | left: '-20px' 1295 | }); 1296 | $keywrap.append($keymgr).insertBefore($img); 1297 | } else { 1298 | $keymgr.insertBefore($img); 1299 | } 1300 | } 1301 | 1302 | 1303 | return { 1304 | watchKeys: watchKeys 1305 | }; 1306 | }()); 1307 | //}}} 1308 | // }}} 1309 | // API methods {{{ 1310 | function setClass(cname) //{{{ 1311 | { 1312 | $div.removeClass().addClass(cssClass('holder')).addClass(cname); 1313 | } 1314 | //}}} 1315 | function animateTo(a, callback) //{{{ 1316 | { 1317 | var x1 = a[0] / xscale, 1318 | y1 = a[1] / yscale, 1319 | x2 = a[2] / xscale, 1320 | y2 = a[3] / yscale; 1321 | 1322 | if (animating) { 1323 | return; 1324 | } 1325 | 1326 | var animto = Coords.flipCoords(x1, y1, x2, y2), 1327 | c = Coords.getFixed(), 1328 | initcr = [c.x, c.y, c.x2, c.y2], 1329 | animat = initcr, 1330 | interv = options.animationDelay, 1331 | ix1 = animto[0] - initcr[0], 1332 | iy1 = animto[1] - initcr[1], 1333 | ix2 = animto[2] - initcr[2], 1334 | iy2 = animto[3] - initcr[3], 1335 | pcent = 0, 1336 | velocity = options.swingSpeed; 1337 | 1338 | x1 = animat[0]; 1339 | y1 = animat[1]; 1340 | x2 = animat[2]; 1341 | y2 = animat[3]; 1342 | 1343 | Selection.animMode(true); 1344 | var anim_timer; 1345 | 1346 | function queueAnimator() { 1347 | window.setTimeout(animator, interv); 1348 | } 1349 | var animator = (function () { 1350 | return function () { 1351 | pcent += (100 - pcent) / velocity; 1352 | 1353 | animat[0] = Math.round(x1 + ((pcent / 100) * ix1)); 1354 | animat[1] = Math.round(y1 + ((pcent / 100) * iy1)); 1355 | animat[2] = Math.round(x2 + ((pcent / 100) * ix2)); 1356 | animat[3] = Math.round(y2 + ((pcent / 100) * iy2)); 1357 | 1358 | if (pcent >= 99.8) { 1359 | pcent = 100; 1360 | } 1361 | if (pcent < 100) { 1362 | setSelectRaw(animat); 1363 | queueAnimator(); 1364 | } else { 1365 | Selection.done(); 1366 | Selection.animMode(false); 1367 | if (typeof(callback) === 'function') { 1368 | callback.call(api); 1369 | } 1370 | } 1371 | }; 1372 | }()); 1373 | queueAnimator(); 1374 | } 1375 | //}}} 1376 | function setSelect(rect) //{{{ 1377 | { 1378 | setSelectRaw([rect[0] / xscale, rect[1] / yscale, rect[2] / xscale, rect[3] / yscale]); 1379 | options.onSelect.call(api, unscale(Coords.getFixed())); 1380 | Selection.enableHandles(); 1381 | } 1382 | //}}} 1383 | function setSelectRaw(l) //{{{ 1384 | { 1385 | Coords.setPressed([l[0], l[1]]); 1386 | Coords.setCurrent([l[2], l[3]]); 1387 | Selection.update(); 1388 | } 1389 | //}}} 1390 | function tellSelect() //{{{ 1391 | { 1392 | return unscale(Coords.getFixed()); 1393 | } 1394 | //}}} 1395 | function tellScaled() //{{{ 1396 | { 1397 | return Coords.getFixed(); 1398 | } 1399 | //}}} 1400 | function setOptionsNew(opt) //{{{ 1401 | { 1402 | setOptions(opt); 1403 | interfaceUpdate(); 1404 | } 1405 | //}}} 1406 | function disableCrop() //{{{ 1407 | { 1408 | options.disabled = true; 1409 | Selection.disableHandles(); 1410 | Selection.setCursor('default'); 1411 | Tracker.setCursor('default'); 1412 | } 1413 | //}}} 1414 | function enableCrop() //{{{ 1415 | { 1416 | options.disabled = false; 1417 | interfaceUpdate(); 1418 | } 1419 | //}}} 1420 | function cancelCrop() //{{{ 1421 | { 1422 | Selection.done(); 1423 | Tracker.activateHandlers(null, null); 1424 | } 1425 | //}}} 1426 | function destroy() //{{{ 1427 | { 1428 | $div.remove(); 1429 | $origimg.show(); 1430 | $origimg.css('visibility','visible'); 1431 | $(obj).removeData('Jcrop'); 1432 | } 1433 | //}}} 1434 | function setImage(src, callback) //{{{ 1435 | { 1436 | Selection.release(); 1437 | disableCrop(); 1438 | var img = new Image(); 1439 | img.onload = function () { 1440 | var iw = img.width; 1441 | var ih = img.height; 1442 | var bw = options.boxWidth; 1443 | var bh = options.boxHeight; 1444 | $img.width(iw).height(ih); 1445 | $img.attr('src', src); 1446 | $img2.attr('src', src); 1447 | presize($img, bw, bh); 1448 | boundx = $img.width(); 1449 | boundy = $img.height(); 1450 | $img2.width(boundx).height(boundy); 1451 | $trk.width(boundx + (bound * 2)).height(boundy + (bound * 2)); 1452 | $div.width(boundx).height(boundy); 1453 | Shade.resize(boundx,boundy); 1454 | enableCrop(); 1455 | 1456 | if (typeof(callback) === 'function') { 1457 | callback.call(api); 1458 | } 1459 | }; 1460 | img.src = src; 1461 | } 1462 | //}}} 1463 | function colorChangeMacro($obj,color,now) { 1464 | var mycolor = color || options.bgColor; 1465 | if (options.bgFade && supportsColorFade() && options.fadeTime && !now) { 1466 | $obj.animate({ 1467 | backgroundColor: mycolor 1468 | }, { 1469 | queue: false, 1470 | duration: options.fadeTime 1471 | }); 1472 | } else { 1473 | $obj.css('backgroundColor', mycolor); 1474 | } 1475 | } 1476 | function interfaceUpdate(alt) //{{{ 1477 | // This method tweaks the interface based on options object. 1478 | // Called when options are changed and at end of initialization. 1479 | { 1480 | if (options.allowResize) { 1481 | if (alt) { 1482 | Selection.enableOnly(); 1483 | } else { 1484 | Selection.enableHandles(); 1485 | } 1486 | } else { 1487 | Selection.disableHandles(); 1488 | } 1489 | 1490 | Tracker.setCursor(options.allowSelect ? 'crosshair' : 'default'); 1491 | Selection.setCursor(options.allowMove ? 'move' : 'default'); 1492 | 1493 | if (options.hasOwnProperty('trueSize')) { 1494 | xscale = options.trueSize[0] / boundx; 1495 | yscale = options.trueSize[1] / boundy; 1496 | } 1497 | 1498 | if (options.hasOwnProperty('setSelect')) { 1499 | setSelect(options.setSelect); 1500 | Selection.done(); 1501 | delete(options.setSelect); 1502 | } 1503 | 1504 | Shade.refresh(); 1505 | 1506 | if (options.bgColor != bgcolor) { 1507 | colorChangeMacro( 1508 | options.shade? Shade.getShades(): $div, 1509 | options.shade? 1510 | (options.shadeColor || options.bgColor): 1511 | options.bgColor 1512 | ); 1513 | bgcolor = options.bgColor; 1514 | } 1515 | 1516 | if (bgopacity != options.bgOpacity) { 1517 | bgopacity = options.bgOpacity; 1518 | if (options.shade) Shade.refresh(); 1519 | else Selection.setBgOpacity(bgopacity); 1520 | } 1521 | 1522 | xlimit = options.maxSize[0] || 0; 1523 | ylimit = options.maxSize[1] || 0; 1524 | xmin = options.minSize[0] || 0; 1525 | ymin = options.minSize[1] || 0; 1526 | 1527 | if (options.hasOwnProperty('outerImage')) { 1528 | $img.attr('src', options.outerImage); 1529 | delete(options.outerImage); 1530 | } 1531 | 1532 | Selection.refresh(); 1533 | } 1534 | //}}} 1535 | //}}} 1536 | 1537 | if (Touch.support) $trk.bind('touchstart.jcrop', Touch.newSelection); 1538 | 1539 | $hdl_holder.hide(); 1540 | interfaceUpdate(true); 1541 | 1542 | var api = { 1543 | setImage: setImage, 1544 | animateTo: animateTo, 1545 | setSelect: setSelect, 1546 | setOptions: setOptionsNew, 1547 | tellSelect: tellSelect, 1548 | tellScaled: tellScaled, 1549 | setClass: setClass, 1550 | 1551 | disable: disableCrop, 1552 | enable: enableCrop, 1553 | cancel: cancelCrop, 1554 | release: Selection.release, 1555 | destroy: destroy, 1556 | 1557 | focus: KeyManager.watchKeys, 1558 | 1559 | getBounds: function () { 1560 | return [boundx * xscale, boundy * yscale]; 1561 | }, 1562 | getWidgetSize: function () { 1563 | return [boundx, boundy]; 1564 | }, 1565 | getScaleFactor: function () { 1566 | return [xscale, yscale]; 1567 | }, 1568 | getOptions: function() { 1569 | // careful: internal values are returned 1570 | return options; 1571 | }, 1572 | 1573 | ui: { 1574 | holder: $div, 1575 | selection: $sel 1576 | } 1577 | }; 1578 | 1579 | if (is_msie) $div.bind('selectstart', function () { return false; }); 1580 | 1581 | $origimg.data('Jcrop', api); 1582 | return api; 1583 | }; 1584 | $.fn.Jcrop = function (options, callback) //{{{ 1585 | { 1586 | var api; 1587 | // Iterate over each object, attach Jcrop 1588 | this.each(function () { 1589 | // If we've already attached to this object 1590 | if ($(this).data('Jcrop')) { 1591 | // The API can be requested this way (undocumented) 1592 | if (options === 'api') return $(this).data('Jcrop'); 1593 | // Otherwise, we just reset the options... 1594 | else $(this).data('Jcrop').setOptions(options); 1595 | } 1596 | // If we haven't been attached, preload and attach 1597 | else { 1598 | if (this.tagName == 'IMG') 1599 | $.Jcrop.Loader(this,function(){ 1600 | $(this).css({display:'block',visibility:'hidden'}); 1601 | api = $.Jcrop(this, options); 1602 | if ($.isFunction(callback)) callback.call(api); 1603 | }); 1604 | else { 1605 | $(this).css({display:'block',visibility:'hidden'}); 1606 | api = $.Jcrop(this, options); 1607 | if ($.isFunction(callback)) callback.call(api); 1608 | } 1609 | } 1610 | }); 1611 | 1612 | // Return "this" so the object is chainable (jQuery-style) 1613 | return this; 1614 | }; 1615 | //}}} 1616 | // $.Jcrop.Loader - basic image loader {{{ 1617 | 1618 | $.Jcrop.Loader = function(imgobj,success,error){ 1619 | var $img = $(imgobj), img = $img[0]; 1620 | 1621 | function completeCheck(){ 1622 | if (img.complete) { 1623 | $img.unbind('.jcloader'); 1624 | if ($.isFunction(success)) success.call(img); 1625 | } 1626 | else window.setTimeout(completeCheck,50); 1627 | } 1628 | 1629 | $img 1630 | .bind('load.jcloader',completeCheck) 1631 | .bind('error.jcloader',function(e){ 1632 | $img.unbind('.jcloader'); 1633 | if ($.isFunction(error)) error.call(img); 1634 | }); 1635 | 1636 | if (img.complete && $.isFunction(success)){ 1637 | $img.unbind('.jcloader'); 1638 | success.call(img); 1639 | } 1640 | }; 1641 | 1642 | //}}} 1643 | // Global Defaults {{{ 1644 | $.Jcrop.defaults = { 1645 | 1646 | // Basic Settings 1647 | allowSelect: true, 1648 | allowMove: true, 1649 | allowResize: true, 1650 | 1651 | trackDocument: true, 1652 | 1653 | // Styling Options 1654 | baseClass: 'jcrop', 1655 | addClass: null, 1656 | bgColor: 'black', 1657 | bgOpacity: 0.6, 1658 | bgFade: false, 1659 | borderOpacity: 0.4, 1660 | handleOpacity: 0.5, 1661 | handleSize: null, 1662 | 1663 | aspectRatio: 0, 1664 | keySupport: true, 1665 | createHandles: ['n','s','e','w','nw','ne','se','sw'], 1666 | createDragbars: ['n','s','e','w'], 1667 | createBorders: ['n','s','e','w'], 1668 | drawBorders: true, 1669 | dragEdges: true, 1670 | fixedSupport: true, 1671 | touchSupport: null, 1672 | 1673 | shade: null, 1674 | 1675 | boxWidth: 0, 1676 | boxHeight: 0, 1677 | boundary: 2, 1678 | fadeTime: 400, 1679 | animationDelay: 20, 1680 | swingSpeed: 3, 1681 | 1682 | minSelect: [0, 0], 1683 | maxSize: [0, 0], 1684 | minSize: [0, 0], 1685 | 1686 | // Callbacks / Event Handlers 1687 | onChange: function () {}, 1688 | onSelect: function () {}, 1689 | onDblClick: function () {}, 1690 | onRelease: function () {} 1691 | }; 1692 | 1693 | // }}} 1694 | }(jQuery)); 1695 | -------------------------------------------------------------------------------- /assets/js/register.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | //On click signup, hide login and show registration form 4 | $("#signup").click(function() { 5 | $("#first").slideUp("slow", function(){ 6 | $("#second").slideDown("slow"); 7 | }); 8 | }); 9 | 10 | //On click signup, hide registration and show login form 11 | $("#signin").click(function() { 12 | $("#second").slideUp("slow", function(){ 13 | $("#first").slideDown("slow"); 14 | }); 15 | }); 16 | 17 | 18 | }); -------------------------------------------------------------------------------- /close_account.php: -------------------------------------------------------------------------------- 1 | 16 | 17 |
18 | 19 |

Close Account

20 | 21 | Are you sure you want to close your account?

22 | Closing your account will hide your profile and all your activity from other users.

23 | You can re-open your account at any time by simply logging in.

24 | 25 |
26 | 27 | 28 |
29 | 30 |
-------------------------------------------------------------------------------- /comment_frame.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 32 | 42 | 43 | insertNotification($post_id, $posted_to, "comment"); 64 | } 65 | 66 | if($user_to != 'none' && $user_to != $userLoggedIn) { 67 | $notification = new Notification($con, $userLoggedIn); 68 | $notification->insertNotification($post_id, $user_to, "profile_comment"); 69 | } 70 | 71 | 72 | $get_commenters = mysqli_query($con, "SELECT * FROM comments WHERE post_id='$post_id'"); 73 | $notified_users = array(); 74 | while($row = mysqli_fetch_array($get_commenters)) { 75 | 76 | if($row['posted_by'] != $posted_to && $row['posted_by'] != $user_to 77 | && $row['posted_by'] != $userLoggedIn && !in_array($row['posted_by'], $notified_users)) { 78 | 79 | $notification = new Notification($con, $userLoggedIn); 80 | $notification->insertNotification($post_id, $row['posted_by'], "comment_non_owner"); 81 | 82 | array_push($notified_users, $row['posted_by']); 83 | } 84 | 85 | } 86 | 87 | 88 | echo "

Comment Posted!

"; 89 | } 90 | ?> 91 |
92 | 93 | 94 |
95 | 96 | 97 | diff($end_date); //Difference between dates 116 | if($interval->y >= 1) { 117 | if($interval == 1) 118 | $time_message = $interval->y . " year ago"; //1 year ago 119 | else 120 | $time_message = $interval->y . " years ago"; //1+ year ago 121 | } 122 | else if ($interval->m >= 1) { 123 | if($interval->d == 0) { 124 | $days = " ago"; 125 | } 126 | else if($interval->d == 1) { 127 | $days = $interval->d . " day ago"; 128 | } 129 | else { 130 | $days = $interval->d . " days ago"; 131 | } 132 | 133 | 134 | if($interval->m == 1) { 135 | $time_message = $interval->m . " month". $days; 136 | } 137 | else { 138 | $time_message = $interval->m . " months". $days; 139 | } 140 | 141 | } 142 | else if($interval->d >= 1) { 143 | if($interval->d == 1) { 144 | $time_message = "Yesterday"; 145 | } 146 | else { 147 | $time_message = $interval->d . " days ago"; 148 | } 149 | } 150 | else if($interval->h >= 1) { 151 | if($interval->h == 1) { 152 | $time_message = $interval->h . " hour ago"; 153 | } 154 | else { 155 | $time_message = $interval->h . " hours ago"; 156 | } 157 | } 158 | else if($interval->i >= 1) { 159 | if($interval->i == 1) { 160 | $time_message = $interval->i . " minute ago"; 161 | } 162 | else { 163 | $time_message = $interval->i . " minutes ago"; 164 | } 165 | } 166 | else { 167 | if($interval->s < 30) { 168 | $time_message = "Just now"; 169 | } 170 | else { 171 | $time_message = $interval->s . " seconds ago"; 172 | } 173 | } 174 | 175 | $user_obj = new User($con, $posted_by); 176 | 177 | 178 | ?> 179 |
180 | 181 | getFirstAndLastName(); ?> 182 |      " . $comment_body; ?> 183 |
184 |
185 |

No Comments to Show!"; 191 | } 192 | 193 | ?> 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/classes/Message.php: -------------------------------------------------------------------------------- 1 | con = $con; 8 | $this->user_obj = new User($con, $user); 9 | } 10 | 11 | public function getMostRecentUser() { 12 | $userLoggedIn = $this->user_obj->getUsername(); 13 | 14 | $query = mysqli_query($this->con, "SELECT user_to, user_from FROM messages WHERE user_to='$userLoggedIn' OR user_from='$userLoggedIn' ORDER BY id DESC LIMIT 1"); 15 | 16 | if(mysqli_num_rows($query) == 0) 17 | return false; 18 | 19 | $row = mysqli_fetch_array($query); 20 | $user_to = $row['user_to']; 21 | $user_from = $row['user_from']; 22 | 23 | if($user_to != $userLoggedIn) 24 | return $user_to; 25 | else 26 | return $user_from; 27 | 28 | } 29 | 30 | public function sendMessage($user_to, $body, $date) { 31 | 32 | if($body != "") { 33 | $userLoggedIn = $this->user_obj->getUsername(); 34 | $query = mysqli_query($this->con, "INSERT INTO messages VALUES('', '$user_to', '$userLoggedIn', '$body', '$date', 'no', 'no', 'no')"); 35 | } 36 | } 37 | 38 | public function getMessages($otherUser) { 39 | $userLoggedIn = $this->user_obj->getUsername(); 40 | $data = ""; 41 | 42 | $query = mysqli_query($this->con, "UPDATE messages SET opened='yes' WHERE user_to='$userLoggedIn' AND user_from='$otherUser'"); 43 | 44 | $get_messages_query = mysqli_query($this->con, "SELECT * FROM messages WHERE (user_to='$userLoggedIn' AND user_from='$otherUser') OR (user_from='$userLoggedIn' AND user_to='$otherUser')"); 45 | 46 | while($row = mysqli_fetch_array($get_messages_query)) { 47 | $user_to = $row['user_to']; 48 | $user_from = $row['user_from']; 49 | $body = $row['body']; 50 | $id = $row['id']; 51 | 52 | $div_top = ($user_to == $userLoggedIn) ? "
" : "
"; 53 | $button = "X"; 54 | $data = $data . $div_top . $button . $body . "


"; 55 | } 56 | return $data; 57 | } 58 | 59 | public function getLatestMessage($userLoggedIn, $user2) { 60 | $details_array = array(); 61 | 62 | $query = mysqli_query($this->con, "SELECT body, user_to, date FROM messages WHERE (user_to='$userLoggedIn' AND user_from='$user2') OR (user_to='$user2' AND user_from='$userLoggedIn') ORDER BY id DESC LIMIT 1"); 63 | 64 | $row = mysqli_fetch_array($query); 65 | $sent_by = ($row['user_to'] == $userLoggedIn) ? "They said: " : "You said: "; 66 | 67 | //Timeframe 68 | $date_time_now = date("Y-m-d H:i:s"); 69 | $start_date = new DateTime($row['date']); //Time of post 70 | $end_date = new DateTime($date_time_now); //Current time 71 | $interval = $start_date->diff($end_date); //Difference between dates 72 | if($interval->y >= 1) { 73 | if($interval->y == 1) 74 | $time_message = $interval->y . " year ago"; //1 year ago 75 | else 76 | $time_message = $interval->y . " years ago"; //1+ year ago 77 | } 78 | else if ($interval->m >= 1) { 79 | if($interval->d == 0) { 80 | $days = " ago"; 81 | } 82 | else if($interval->d == 1) { 83 | $days = $interval->d . " day ago"; 84 | } 85 | else { 86 | $days = $interval->d . " days ago"; 87 | } 88 | 89 | 90 | if($interval->m == 1) { 91 | $time_message = $interval->m . " month". $days; 92 | } 93 | else { 94 | $time_message = $interval->m . " months". $days; 95 | } 96 | 97 | } 98 | else if($interval->d >= 1) { 99 | if($interval->d == 1) { 100 | $time_message = "Yesterday"; 101 | } 102 | else { 103 | $time_message = $interval->d . " days ago"; 104 | } 105 | } 106 | else if($interval->h >= 1) { 107 | if($interval->h == 1) { 108 | $time_message = $interval->h . " hour ago"; 109 | } 110 | else { 111 | $time_message = $interval->h . " hours ago"; 112 | } 113 | } 114 | else if($interval->i >= 1) { 115 | if($interval->i == 1) { 116 | $time_message = $interval->i . " minute ago"; 117 | } 118 | else { 119 | $time_message = $interval->i . " minutes ago"; 120 | } 121 | } 122 | else { 123 | if($interval->s < 30) { 124 | $time_message = "Just now"; 125 | } 126 | else { 127 | $time_message = $interval->s . " seconds ago"; 128 | } 129 | } 130 | 131 | array_push($details_array, $sent_by); 132 | array_push($details_array, $row['body']); 133 | array_push($details_array, $time_message); 134 | 135 | return $details_array; 136 | } 137 | 138 | public function getConvos() { 139 | $userLoggedIn = $this->user_obj->getUsername(); 140 | $return_string = ""; 141 | $convos = array(); 142 | 143 | $query = mysqli_query($this->con, "SELECT user_to, user_from FROM messages WHERE user_to='$userLoggedIn' OR user_from='$userLoggedIn' ORDER BY id DESC"); 144 | 145 | while($row = mysqli_fetch_array($query)) { 146 | $user_to_push = ($row['user_to'] != $userLoggedIn) ? $row['user_to'] : $row['user_from']; 147 | 148 | if(!in_array($user_to_push, $convos)) { 149 | array_push($convos, $user_to_push); 150 | } 151 | } 152 | 153 | foreach($convos as $username) { 154 | $user_found_obj = new User($this->con, $username); 155 | $latest_message_details = $this->getLatestMessage($userLoggedIn, $username); 156 | 157 | $dots = (strlen($latest_message_details[1]) >= 12) ? "..." : ""; 158 | $split = str_split($latest_message_details[1], 12); 159 | $split = $split[0] . $dots; 160 | 161 | $return_string .= "
162 | 163 | " . $user_found_obj->getFirstAndLastName() . " 164 | " . $latest_message_details[2] . " 165 |

" . $latest_message_details[0] . $split . "

166 |
167 |
"; 168 | } 169 | 170 | return $return_string; 171 | 172 | } 173 | 174 | public function getConvosDropdown($data, $limit) { 175 | 176 | $page = $data['page']; 177 | $userLoggedIn = $this->user_obj->getUsername(); 178 | $return_string = ""; 179 | $convos = array(); 180 | 181 | if($page == 1) 182 | $start = 0; 183 | else 184 | $start = ($page - 1) * $limit; 185 | 186 | $set_viewed_query = mysqli_query($this->con, "UPDATE messages SET viewed='yes' WHERE user_to='$userLoggedIn'"); 187 | 188 | $query = mysqli_query($this->con, "SELECT user_to, user_from FROM messages WHERE user_to='$userLoggedIn' OR user_from='$userLoggedIn' ORDER BY id DESC"); 189 | 190 | while($row = mysqli_fetch_array($query)) { 191 | $user_to_push = ($row['user_to'] != $userLoggedIn) ? $row['user_to'] : $row['user_from']; 192 | 193 | if(!in_array($user_to_push, $convos)) { 194 | array_push($convos, $user_to_push); 195 | } 196 | } 197 | 198 | $num_iterations = 0; //Number of messages checked 199 | $count = 1; //Number of messages posted 200 | 201 | foreach($convos as $username) { 202 | 203 | if($num_iterations++ < $start) 204 | continue; 205 | 206 | if($count > $limit) 207 | break; 208 | else 209 | $count++; 210 | 211 | 212 | $is_unread_query = mysqli_query($this->con, "SELECT opened FROM messages WHERE user_to='$userLoggedIn' AND user_from='$username' ORDER BY id DESC"); 213 | $row = mysqli_fetch_array($is_unread_query); 214 | $style = ($row['opened'] == 'no') ? "background-color: #DDEDFF;" : ""; 215 | 216 | 217 | $user_found_obj = new User($this->con, $username); 218 | $latest_message_details = $this->getLatestMessage($userLoggedIn, $username); 219 | 220 | $dots = (strlen($latest_message_details[1]) >= 12) ? "..." : ""; 221 | $split = str_split($latest_message_details[1], 12); 222 | $split = $split[0] . $dots; 223 | 224 | $return_string .= " 225 |
226 | 227 | " . $user_found_obj->getFirstAndLastName() . " 228 | " . $latest_message_details[2] . " 229 |

" . $latest_message_details[0] . $split . "

230 |
231 |
"; 232 | } 233 | 234 | 235 | //If posts were loaded 236 | if($count > $limit) 237 | $return_string .= ""; 238 | else 239 | $return_string .= "

No more messages to load!

"; 240 | 241 | return $return_string; 242 | } 243 | 244 | public function getUnreadNumber() { 245 | $userLoggedIn = $this->user_obj->getUsername(); 246 | $query = mysqli_query($this->con, "SELECT * FROM messages WHERE viewed='no' AND user_to='$userLoggedIn'"); 247 | return mysqli_num_rows($query); 248 | } 249 | 250 | } 251 | 252 | ?> -------------------------------------------------------------------------------- /includes/classes/Notification.php: -------------------------------------------------------------------------------- 1 | con = $con; 8 | $this->user_obj = new User($con, $user); 9 | } 10 | 11 | public function getUnreadNumber() { 12 | $userLoggedIn = $this->user_obj->getUsername(); 13 | $query = mysqli_query($this->con, "SELECT * FROM notifications WHERE viewed='no' AND user_to='$userLoggedIn'"); 14 | return mysqli_num_rows($query); 15 | } 16 | 17 | public function getNotifications($data, $limit) { 18 | 19 | $page = $data['page']; 20 | $userLoggedIn = $this->user_obj->getUsername(); 21 | $return_string = ""; 22 | 23 | if($page == 1) 24 | $start = 0; 25 | else 26 | $start = ($page - 1) * $limit; 27 | 28 | $set_viewed_query = mysqli_query($this->con, "UPDATE notifications SET viewed='yes' WHERE user_to='$userLoggedIn'"); 29 | 30 | $query = mysqli_query($this->con, "SELECT * FROM notifications WHERE user_to='$userLoggedIn' ORDER BY id DESC"); 31 | 32 | if(mysqli_num_rows($query) == 0) { 33 | echo "You have no notifications!"; 34 | return; 35 | } 36 | 37 | $num_iterations = 0; //Number of messages checked 38 | $count = 1; //Number of messages posted 39 | 40 | while($row = mysqli_fetch_array($query)) { 41 | 42 | if($num_iterations++ < $start) 43 | continue; 44 | 45 | if($count > $limit) 46 | break; 47 | else 48 | $count++; 49 | 50 | 51 | $user_from = $row['user_from']; 52 | 53 | $user_data_query = mysqli_query($this->con, "SELECT * FROM users WHERE username='$user_from'"); 54 | $user_data = mysqli_fetch_array($user_data_query); 55 | 56 | 57 | //Timeframe 58 | $date_time_now = date("Y-m-d H:i:s"); 59 | $start_date = new DateTime($row['datetime']); //Time of post 60 | $end_date = new DateTime($date_time_now); //Current time 61 | $interval = $start_date->diff($end_date); //Difference between dates 62 | if($interval->y >= 1) { 63 | if($interval == 1) 64 | $time_message = $interval->y . " year ago"; //1 year ago 65 | else 66 | $time_message = $interval->y . " years ago"; //1+ year ago 67 | } 68 | else if ($interval->m >= 1) { 69 | if($interval->d == 0) { 70 | $days = " ago"; 71 | } 72 | else if($interval->d == 1) { 73 | $days = $interval->d . " day ago"; 74 | } 75 | else { 76 | $days = $interval->d . " days ago"; 77 | } 78 | 79 | 80 | if($interval->m == 1) { 81 | $time_message = $interval->m . " month". $days; 82 | } 83 | else { 84 | $time_message = $interval->m . " months". $days; 85 | } 86 | 87 | } 88 | else if($interval->d >= 1) { 89 | if($interval->d == 1) { 90 | $time_message = "Yesterday"; 91 | } 92 | else { 93 | $time_message = $interval->d . " days ago"; 94 | } 95 | } 96 | else if($interval->h >= 1) { 97 | if($interval->h == 1) { 98 | $time_message = $interval->h . " hour ago"; 99 | } 100 | else { 101 | $time_message = $interval->h . " hours ago"; 102 | } 103 | } 104 | else if($interval->i >= 1) { 105 | if($interval->i == 1) { 106 | $time_message = $interval->i . " minute ago"; 107 | } 108 | else { 109 | $time_message = $interval->i . " minutes ago"; 110 | } 111 | } 112 | else { 113 | if($interval->s < 30) { 114 | $time_message = "Just now"; 115 | } 116 | else { 117 | $time_message = $interval->s . " seconds ago"; 118 | } 119 | } 120 | 121 | $opened = $row['opened']; 122 | $style = ($opened == 'no') ? "background-color: #DDEDFF;" : ""; 123 | 124 | $return_string .= " 125 |
126 |
127 | 128 |
129 |

" . $time_message . "

" . $row['message'] . " 130 |
131 |
"; 132 | } 133 | 134 | 135 | //If posts were loaded 136 | if($count > $limit) 137 | $return_string .= ""; 138 | else 139 | $return_string .= "

No more notifications to load!

"; 140 | 141 | return $return_string; 142 | } 143 | 144 | public function insertNotification($post_id, $user_to, $type) { 145 | 146 | $userLoggedIn = $this->user_obj->getUsername(); 147 | $userLoggedInName = $this->user_obj->getFirstAndLastName(); 148 | 149 | $date_time = date("Y-m-d H:i:s"); 150 | 151 | switch($type) { 152 | case 'comment': 153 | $message = $userLoggedInName . " commented on your post"; 154 | break; 155 | case 'like': 156 | $message = $userLoggedInName . " liked your post"; 157 | break; 158 | case 'profile_post': 159 | $message = $userLoggedInName . " posted on your profile"; 160 | break; 161 | case 'comment_non_owner': 162 | $message = $userLoggedInName . " commented on a post you commented on"; 163 | break; 164 | case 'profile_comment': 165 | $message = $userLoggedInName . " commented on your profile post"; 166 | break; 167 | } 168 | 169 | $link = "post.php?id=" . $post_id; 170 | 171 | $insert_query = mysqli_query($this->con, "INSERT INTO notifications VALUES('', '$user_to', '$userLoggedIn', '$message', '$link', '$date_time', 'no', 'no')"); 172 | } 173 | 174 | } 175 | 176 | ?> -------------------------------------------------------------------------------- /includes/classes/Post.php: -------------------------------------------------------------------------------- 1 | con = $con; 8 | $this->user_obj = new User($con, $user); 9 | } 10 | 11 | public function submitPost($body, $user_to, $imageName) { 12 | $body = strip_tags($body); //removes html tags 13 | $body = mysqli_real_escape_string($this->con, $body); 14 | $body = str_replace('\r\n', "\n", $body); 15 | $body = nl2br($body); 16 | $check_empty = preg_replace('/\s+/', '', $body); //Deltes all spaces 17 | 18 | if($check_empty != "") { 19 | 20 | 21 | $body_array = preg_split("/\s+/", $body); 22 | 23 | foreach($body_array as $key => $value) { 24 | 25 | if(strpos($value, "www.youtube.com/watch?v=") !== false) { 26 | 27 | $link = preg_split("!&!", $value); 28 | $value = preg_replace("!watch\?v=!", "embed/", $link[0]); 29 | $value = "

"; 30 | $body_array[$key] = $value; 31 | 32 | } 33 | 34 | } 35 | $body = implode(" ", $body_array); 36 | 37 | 38 | 39 | //Current date and time 40 | $date_added = date("Y-m-d H:i:s"); 41 | //Get username 42 | $added_by = $this->user_obj->getUsername(); 43 | 44 | //If user is on own profile, user_to is 'none' 45 | if($user_to == $added_by) 46 | $user_to = "none"; 47 | 48 | //insert post 49 | $query = mysqli_query($this->con, "INSERT INTO posts VALUES('', '$body', '$added_by', '$user_to', '$date_added', 'no', 'no', '0', '$imageName')"); 50 | $returned_id = mysqli_insert_id($this->con); 51 | 52 | //Insert notification 53 | if($user_to != 'none') { 54 | $notification = new Notification($this->con, $added_by); 55 | $notification->insertNotification($returned_id, $user_to, "like"); 56 | } 57 | 58 | //Update post count for user 59 | $num_posts = $this->user_obj->getNumPosts(); 60 | $num_posts++; 61 | $update_query = mysqli_query($this->con, "UPDATE users SET num_posts='$num_posts' WHERE username='$added_by'"); 62 | 63 | 64 | $stopWords = "a about above across after again against all almost alone along already 65 | also although always among am an and another any anybody anyone anything anywhere are 66 | area areas around as ask asked asking asks at away b back backed backing backs be became 67 | because become becomes been before began behind being beings best better between big 68 | both but by c came can cannot case cases certain certainly clear clearly come could 69 | d did differ different differently do does done down down downed downing downs during 70 | e each early either end ended ending ends enough even evenly ever every everybody 71 | everyone everything everywhere f face faces fact facts far felt few find finds first 72 | for four from full fully further furthered furthering furthers g gave general generally 73 | get gets give given gives go going good goods got great greater greatest group grouped 74 | grouping groups h had has have having he her here herself high high high higher 75 | highest him himself his how however i im if important in interest interested interesting 76 | interests into is it its itself j just k keep keeps kind knew know known knows 77 | large largely last later latest least less let lets like likely long longer 78 | longest m made make making man many may me member members men might more most 79 | mostly mr mrs much must my myself n necessary need needed needing needs never 80 | new new newer newest next no nobody non noone not nothing now nowhere number 81 | numbers o of off often old older oldest on once one only open opened opening 82 | opens or order ordered ordering orders other others our out over p part parted 83 | parting parts per perhaps place places point pointed pointing points possible 84 | present presented presenting presents problem problems put puts q quite r 85 | rather really right right room rooms s said same saw say says second seconds 86 | see seem seemed seeming seems sees several shall she should show showed 87 | showing shows side sides since small smaller smallest so some somebody 88 | someone something somewhere state states still still such sure t take 89 | taken than that the their them then there therefore these they thing 90 | things think thinks this those though thought thoughts three through 91 | thus to today together too took toward turn turned turning turns two 92 | u under until up upon us use used uses v very w want wanted wanting 93 | wants was way ways we well wells went were what when where whether 94 | which while who whole whose why will with within without work 95 | worked working works would x y year years yet you young younger 96 | youngest your yours z lol haha omg hey ill iframe wonder else like 97 | hate sleepy reason for some little yes bye choose"; 98 | 99 | //Convert stop words into array - split at white space 100 | $stopWords = preg_split("/[\s,]+/", $stopWords); 101 | 102 | //Remove all punctionation 103 | $no_punctuation = preg_replace("/[^a-zA-Z 0-9]+/", "", $body); 104 | 105 | //Predict whether user is posting a url. If so, do not check for trending words 106 | if(strpos($no_punctuation, "height") === false && strpos($no_punctuation, "width") === false 107 | && strpos($no_punctuation, "http") === false && strpos($no_punctuation, "youtube") === false){ 108 | //Convert users post (with punctuation removed) into array - split at white space 109 | $keywords = preg_split("/[\s,]+/", $no_punctuation); 110 | 111 | foreach($stopWords as $value) { 112 | foreach($keywords as $key => $value2){ 113 | if(strtolower($value) == strtolower($value2)) 114 | $keywords[$key] = ""; 115 | } 116 | } 117 | 118 | foreach ($keywords as $value) { 119 | $this->calculateTrend(ucfirst($value)); 120 | } 121 | 122 | } 123 | 124 | } 125 | } 126 | 127 | public function calculateTrend($term) { 128 | 129 | if($term != '') { 130 | $query = mysqli_query($this->con, "SELECT * FROM trends WHERE title='$term'"); 131 | 132 | if(mysqli_num_rows($query) == 0) 133 | $insert_query = mysqli_query($this->con, "INSERT INTO trends(title,hits) VALUES('$term','1')"); 134 | else 135 | $insert_query = mysqli_query($this->con, "UPDATE trends SET hits=hits+1 WHERE title='$term'"); 136 | } 137 | 138 | } 139 | 140 | public function loadPostsFriends($data, $limit) { 141 | 142 | $page = $data['page']; 143 | $userLoggedIn = $this->user_obj->getUsername(); 144 | 145 | if($page == 1) 146 | $start = 0; 147 | else 148 | $start = ($page - 1) * $limit; 149 | 150 | 151 | $str = ""; //String to return 152 | $data_query = mysqli_query($this->con, "SELECT * FROM posts WHERE deleted='no' ORDER BY id DESC"); 153 | 154 | if(mysqli_num_rows($data_query) > 0) { 155 | 156 | 157 | $num_iterations = 0; //Number of results checked (not necasserily posted) 158 | $count = 1; 159 | 160 | while($row = mysqli_fetch_array($data_query)) { 161 | $id = $row['id']; 162 | $body = $row['body']; 163 | $added_by = $row['added_by']; 164 | $date_time = $row['date_added']; 165 | $imagePath = $row['image']; 166 | 167 | //Prepare user_to string so it can be included even if not posted to a user 168 | if($row['user_to'] == "none") { 169 | $user_to = ""; 170 | } 171 | else { 172 | $user_to_obj = new User($this->con, $row['user_to']); 173 | $user_to_name = $user_to_obj->getFirstAndLastName(); 174 | $user_to = "to " . $user_to_name . ""; 175 | } 176 | 177 | //Check if user who posted, has their account closed 178 | $added_by_obj = new User($this->con, $added_by); 179 | if($added_by_obj->isClosed()) { 180 | continue; 181 | } 182 | 183 | $user_logged_obj = new User($this->con, $userLoggedIn); 184 | if($user_logged_obj->isFriend($added_by)){ 185 | 186 | if($num_iterations++ < $start) 187 | continue; 188 | 189 | 190 | //Once 10 posts have been loaded, break 191 | if($count > $limit) { 192 | break; 193 | } 194 | else { 195 | $count++; 196 | } 197 | 198 | if($userLoggedIn == $added_by) 199 | $delete_button = ""; 200 | else 201 | $delete_button = ""; 202 | 203 | 204 | $user_details_query = mysqli_query($this->con, "SELECT first_name, last_name, profile_pic FROM users WHERE username='$added_by'"); 205 | $user_row = mysqli_fetch_array($user_details_query); 206 | $first_name = $user_row['first_name']; 207 | $last_name = $user_row['last_name']; 208 | $profile_pic = $user_row['profile_pic']; 209 | 210 | 211 | ?> 212 | 227 | con, "SELECT * FROM comments WHERE post_id='$id'"); 230 | $comments_check_num = mysqli_num_rows($comments_check); 231 | 232 | 233 | //Timeframe 234 | $date_time_now = date("Y-m-d H:i:s"); 235 | $start_date = new DateTime($date_time); //Time of post 236 | $end_date = new DateTime($date_time_now); //Current time 237 | $interval = $start_date->diff($end_date); //Difference between dates 238 | if($interval->y >= 1) { 239 | if($interval->y == 1) 240 | $time_message = $interval->y . " year ago"; //1 year ago 241 | else 242 | $time_message = $interval->y . " years ago"; //1+ year ago 243 | } 244 | else if ($interval->m >= 1) { 245 | if($interval->d == 0) { 246 | $days = " ago"; 247 | } 248 | else if($interval->d == 1) { 249 | $days = $interval->d . " day ago"; 250 | } 251 | else { 252 | $days = $interval->d . " days ago"; 253 | } 254 | 255 | 256 | if($interval->m == 1) { 257 | $time_message = $interval->m . " month ". $days; 258 | } 259 | else { 260 | $time_message = $interval->m . " months ". $days; 261 | } 262 | 263 | } 264 | else if($interval->d >= 1) { 265 | if($interval->d == 1) { 266 | $time_message = "Yesterday"; 267 | } 268 | else { 269 | $time_message = $interval->d . " days ago"; 270 | } 271 | } 272 | else if($interval->h >= 1) { 273 | if($interval->h == 1) { 274 | $time_message = $interval->h . " hour ago"; 275 | } 276 | else { 277 | $time_message = $interval->h . " hours ago"; 278 | } 279 | } 280 | else if($interval->i >= 1) { 281 | if($interval->i == 1) { 282 | $time_message = $interval->i . " minute ago"; 283 | } 284 | else { 285 | $time_message = $interval->i . " minutes ago"; 286 | } 287 | } 288 | else { 289 | if($interval->s < 30) { 290 | $time_message = "Just now"; 291 | } 292 | else { 293 | $time_message = $interval->s . " seconds ago"; 294 | } 295 | } 296 | 297 | if($imagePath != "") { 298 | $imageDiv = "
299 | 300 |
"; 301 | } 302 | else { 303 | $imageDiv = ""; 304 | } 305 | 306 | $str .= "
307 |
308 | 309 |
310 | 311 |
312 | $first_name $last_name $user_to     $time_message 313 | $delete_button 314 |
315 |
316 | $body 317 |
318 | $imageDiv 319 |
320 |
321 |
322 | 323 |
324 | Comments($comments_check_num)    325 | 326 |
327 | 328 |
329 | 332 |
"; 333 | } 334 | 335 | ?> 336 | 355 | $limit) 360 | $str .= " 361 | "; 362 | else 363 | $str .= "

No more posts to show!

"; 364 | } 365 | 366 | echo $str; 367 | } 368 | 369 | 370 | public function loadProfilePosts($data, $limit) { 371 | 372 | $page = $data['page']; 373 | $profileUser = $data['profileUsername']; 374 | $userLoggedIn = $this->user_obj->getUsername(); 375 | 376 | if($page == 1) 377 | $start = 0; 378 | else 379 | $start = ($page - 1) * $limit; 380 | 381 | 382 | $str = ""; //String to return 383 | $data_query = mysqli_query($this->con, "SELECT * FROM posts WHERE deleted='no' AND ((added_by='$profileUser' AND user_to='none') OR user_to='$profileUser') ORDER BY id DESC"); 384 | 385 | if(mysqli_num_rows($data_query) > 0) { 386 | 387 | 388 | $num_iterations = 0; //Number of results checked (not necasserily posted) 389 | $count = 1; 390 | 391 | while($row = mysqli_fetch_array($data_query)) { 392 | $id = $row['id']; 393 | $body = $row['body']; 394 | $added_by = $row['added_by']; 395 | $date_time = $row['date_added']; 396 | 397 | 398 | if($num_iterations++ < $start) 399 | continue; 400 | 401 | 402 | //Once 10 posts have been loaded, break 403 | if($count > $limit) { 404 | break; 405 | } 406 | else { 407 | $count++; 408 | } 409 | 410 | if($userLoggedIn == $added_by) 411 | $delete_button = ""; 412 | else 413 | $delete_button = ""; 414 | 415 | 416 | $user_details_query = mysqli_query($this->con, "SELECT first_name, last_name, profile_pic FROM users WHERE username='$added_by'"); 417 | $user_row = mysqli_fetch_array($user_details_query); 418 | $first_name = $user_row['first_name']; 419 | $last_name = $user_row['last_name']; 420 | $profile_pic = $user_row['profile_pic']; 421 | 422 | 423 | ?> 424 | 439 | con, "SELECT * FROM comments WHERE post_id='$id'"); 442 | $comments_check_num = mysqli_num_rows($comments_check); 443 | 444 | 445 | //Timeframe 446 | $date_time_now = date("Y-m-d H:i:s"); 447 | $start_date = new DateTime($date_time); //Time of post 448 | $end_date = new DateTime($date_time_now); //Current time 449 | $interval = $start_date->diff($end_date); //Difference between dates 450 | if($interval->y >= 1) { 451 | if($interval->y == 1) 452 | $time_message = $interval->y . " year ago"; //1 year ago 453 | else 454 | $time_message = $interval->y . " years ago"; //1+ year ago 455 | } 456 | else if ($interval->m >= 1) { 457 | if($interval->d == 0) { 458 | $days = " ago"; 459 | } 460 | else if($interval->d == 1) { 461 | $days = $interval->d . " day ago"; 462 | } 463 | else { 464 | $days = $interval->d . " days ago"; 465 | } 466 | 467 | 468 | if($interval->m == 1) { 469 | $time_message = $interval->m . " month". $days; 470 | } 471 | else { 472 | $time_message = $interval->m . " months". $days; 473 | } 474 | 475 | } 476 | else if($interval->d >= 1) { 477 | if($interval->d == 1) { 478 | $time_message = "Yesterday"; 479 | } 480 | else { 481 | $time_message = $interval->d . " days ago"; 482 | } 483 | } 484 | else if($interval->h >= 1) { 485 | if($interval->h == 1) { 486 | $time_message = $interval->h . " hour ago"; 487 | } 488 | else { 489 | $time_message = $interval->h . " hours ago"; 490 | } 491 | } 492 | else if($interval->i >= 1) { 493 | if($interval->i == 1) { 494 | $time_message = $interval->i . " minute ago"; 495 | } 496 | else { 497 | $time_message = $interval->i . " minutes ago"; 498 | } 499 | } 500 | else { 501 | if($interval->s < 30) { 502 | $time_message = "Just now"; 503 | } 504 | else { 505 | $time_message = $interval->s . " seconds ago"; 506 | } 507 | } 508 | 509 | $str .= "
510 |
511 | 512 |
513 | 514 |
515 | $first_name $last_name     $time_message 516 | $delete_button 517 |
518 |
519 | $body 520 |
521 |
522 |
523 |
524 | 525 |
526 | Comments($comments_check_num)    527 | 528 |
529 | 530 |
531 | 534 |
"; 535 | 536 | ?> 537 | 556 | $limit) 561 | $str .= " 562 | "; 563 | else 564 | $str .= "

No more posts to show!

"; 565 | } 566 | 567 | echo $str; 568 | 569 | 570 | } 571 | 572 | public function getSinglePost($post_id) { 573 | 574 | $userLoggedIn = $this->user_obj->getUsername(); 575 | 576 | $opened_query = mysqli_query($this->con, "UPDATE notifications SET opened='yes' WHERE user_to='$userLoggedIn' AND link LIKE '%=$post_id'"); 577 | 578 | $str = ""; //String to return 579 | $data_query = mysqli_query($this->con, "SELECT * FROM posts WHERE deleted='no' AND id='$post_id'"); 580 | 581 | if(mysqli_num_rows($data_query) > 0) { 582 | 583 | 584 | $row = mysqli_fetch_array($data_query); 585 | $id = $row['id']; 586 | $body = $row['body']; 587 | $added_by = $row['added_by']; 588 | $date_time = $row['date_added']; 589 | 590 | //Prepare user_to string so it can be included even if not posted to a user 591 | if($row['user_to'] == "none") { 592 | $user_to = ""; 593 | } 594 | else { 595 | $user_to_obj = new User($this->con, $row['user_to']); 596 | $user_to_name = $user_to_obj->getFirstAndLastName(); 597 | $user_to = "to " . $user_to_name . ""; 598 | } 599 | 600 | //Check if user who posted, has their account closed 601 | $added_by_obj = new User($this->con, $added_by); 602 | if($added_by_obj->isClosed()) { 603 | return; 604 | } 605 | 606 | $user_logged_obj = new User($this->con, $userLoggedIn); 607 | if($user_logged_obj->isFriend($added_by)){ 608 | 609 | 610 | if($userLoggedIn == $added_by) 611 | $delete_button = ""; 612 | else 613 | $delete_button = ""; 614 | 615 | 616 | $user_details_query = mysqli_query($this->con, "SELECT first_name, last_name, profile_pic FROM users WHERE username='$added_by'"); 617 | $user_row = mysqli_fetch_array($user_details_query); 618 | $first_name = $user_row['first_name']; 619 | $last_name = $user_row['last_name']; 620 | $profile_pic = $user_row['profile_pic']; 621 | 622 | 623 | ?> 624 | 641 | con, "SELECT * FROM comments WHERE post_id='$id'"); 644 | $comments_check_num = mysqli_num_rows($comments_check); 645 | 646 | 647 | //Timeframe 648 | $date_time_now = date("Y-m-d H:i:s"); 649 | $start_date = new DateTime($date_time); //Time of post 650 | $end_date = new DateTime($date_time_now); //Current time 651 | $interval = $start_date->diff($end_date); //Difference between dates 652 | if($interval->y >= 1) { 653 | if($interval == 1) 654 | $time_message = $interval->y . " year ago"; //1 year ago 655 | else 656 | $time_message = $interval->y . " years ago"; //1+ year ago 657 | } 658 | else if ($interval->m >= 1) { 659 | if($interval->d == 0) { 660 | $days = " ago"; 661 | } 662 | else if($interval->d == 1) { 663 | $days = $interval->d . " day ago"; 664 | } 665 | else { 666 | $days = $interval->d . " days ago"; 667 | } 668 | 669 | 670 | if($interval->m == 1) { 671 | $time_message = $interval->m . " month". $days; 672 | } 673 | else { 674 | $time_message = $interval->m . " months". $days; 675 | } 676 | 677 | } 678 | else if($interval->d >= 1) { 679 | if($interval->d == 1) { 680 | $time_message = "Yesterday"; 681 | } 682 | else { 683 | $time_message = $interval->d . " days ago"; 684 | } 685 | } 686 | else if($interval->h >= 1) { 687 | if($interval->h == 1) { 688 | $time_message = $interval->h . " hour ago"; 689 | } 690 | else { 691 | $time_message = $interval->h . " hours ago"; 692 | } 693 | } 694 | else if($interval->i >= 1) { 695 | if($interval->i == 1) { 696 | $time_message = $interval->i . " minute ago"; 697 | } 698 | else { 699 | $time_message = $interval->i . " minutes ago"; 700 | } 701 | } 702 | else { 703 | if($interval->s < 30) { 704 | $time_message = "Just now"; 705 | } 706 | else { 707 | $time_message = $interval->s . " seconds ago"; 708 | } 709 | } 710 | 711 | $str .= "
712 |
713 | 714 |
715 | 716 |
717 | $first_name $last_name $user_to     $time_message 718 | $delete_button 719 |
720 |
721 | $body 722 |
723 |
724 |
725 |
726 | 727 |
728 | Comments($comments_check_num)    729 | 730 |
731 | 732 |
733 | 736 |
"; 737 | 738 | 739 | ?> 740 | 759 | You cannot see this post because you are not friends with this user.

"; 763 | return; 764 | } 765 | } 766 | else { 767 | echo "

No post found. If you clicked a link, it may be broken.

"; 768 | return; 769 | } 770 | 771 | echo $str; 772 | } 773 | 774 | 775 | 776 | } 777 | 778 | ?> -------------------------------------------------------------------------------- /includes/classes/User.php: -------------------------------------------------------------------------------- 1 | con = $con; 8 | $user_details_query = mysqli_query($con, "SELECT * FROM users WHERE username='$user'"); 9 | $this->user = mysqli_fetch_array($user_details_query); 10 | } 11 | 12 | public function getUsername() { 13 | return $this->user['username']; 14 | } 15 | 16 | public function getNumberOfFriendRequests() { 17 | $username = $this->user['username']; 18 | $query = mysqli_query($this->con, "SELECT * FROM friend_requests WHERE user_to='$username'"); 19 | return mysqli_num_rows($query); 20 | } 21 | 22 | public function getNumPosts() { 23 | $username = $this->user['username']; 24 | $query = mysqli_query($this->con, "SELECT num_posts FROM users WHERE username='$username'"); 25 | $row = mysqli_fetch_array($query); 26 | return $row['num_posts']; 27 | } 28 | 29 | public function getFirstAndLastName() { 30 | $username = $this->user['username']; 31 | $query = mysqli_query($this->con, "SELECT first_name, last_name FROM users WHERE username='$username'"); 32 | $row = mysqli_fetch_array($query); 33 | return $row['first_name'] . " " . $row['last_name']; 34 | } 35 | 36 | public function getProfilePic() { 37 | $username = $this->user['username']; 38 | $query = mysqli_query($this->con, "SELECT profile_pic FROM users WHERE username='$username'"); 39 | $row = mysqli_fetch_array($query); 40 | return $row['profile_pic']; 41 | } 42 | 43 | public function getFriendArray() { 44 | $username = $this->user['username']; 45 | $query = mysqli_query($this->con, "SELECT friend_array FROM users WHERE username='$username'"); 46 | $row = mysqli_fetch_array($query); 47 | return $row['friend_array']; 48 | } 49 | 50 | public function isClosed() { 51 | $username = $this->user['username']; 52 | $query = mysqli_query($this->con, "SELECT user_closed FROM users WHERE username='$username'"); 53 | $row = mysqli_fetch_array($query); 54 | 55 | if($row['user_closed'] == 'yes') 56 | return true; 57 | else 58 | return false; 59 | } 60 | 61 | public function isFriend($username_to_check) { 62 | $usernameComma = "," . $username_to_check . ","; 63 | 64 | if((strstr($this->user['friend_array'], $usernameComma) || $username_to_check == $this->user['username'])) { 65 | return true; 66 | } 67 | else { 68 | return false; 69 | } 70 | } 71 | 72 | public function didReceiveRequest($user_from) { 73 | $user_to = $this->user['username']; 74 | $check_request_query = mysqli_query($this->con, "SELECT * FROM friend_requests WHERE user_to='$user_to' AND user_from='$user_from'"); 75 | if(mysqli_num_rows($check_request_query) > 0) { 76 | return true; 77 | } 78 | else { 79 | return false; 80 | } 81 | } 82 | 83 | public function didSendRequest($user_to) { 84 | $user_from = $this->user['username']; 85 | $check_request_query = mysqli_query($this->con, "SELECT * FROM friend_requests WHERE user_to='$user_to' AND user_from='$user_from'"); 86 | if(mysqli_num_rows($check_request_query) > 0) { 87 | return true; 88 | } 89 | else { 90 | return false; 91 | } 92 | } 93 | 94 | public function removeFriend($user_to_remove) { 95 | $logged_in_user = $this->user['username']; 96 | 97 | $query = mysqli_query($this->con, "SELECT friend_array FROM users WHERE username='$user_to_remove'"); 98 | $row = mysqli_fetch_array($query); 99 | $friend_array_username = $row['friend_array']; 100 | 101 | $new_friend_array = str_replace($user_to_remove . ",", "", $this->user['friend_array']); 102 | $remove_friend = mysqli_query($this->con, "UPDATE users SET friend_array='$new_friend_array' WHERE username='$logged_in_user'"); 103 | 104 | $new_friend_array = str_replace($this->user['username'] . ",", "", $friend_array_username); 105 | $remove_friend = mysqli_query($this->con, "UPDATE users SET friend_array='$new_friend_array' WHERE username='$user_to_remove'"); 106 | } 107 | 108 | public function sendRequest($user_to) { 109 | $user_from = $this->user['username']; 110 | $query = mysqli_query($this->con, "INSERT INTO friend_requests VALUES('', '$user_to', '$user_from')"); 111 | } 112 | 113 | public function getMutualFriends($user_to_check) { 114 | $mutualFriends = 0; 115 | $user_array = $this->user['friend_array']; 116 | $user_array_explode = explode(",", $user_array); 117 | 118 | $query = mysqli_query($this->con, "SELECT friend_array FROM users WHERE username='$user_to_check'"); 119 | $row = mysqli_fetch_array($query); 120 | $user_to_check_array = $row['friend_array']; 121 | $user_to_check_array_explode = explode(",", $user_to_check_array); 122 | 123 | foreach($user_array_explode as $i) { 124 | 125 | foreach($user_to_check_array_explode as $j) { 126 | 127 | if($i == $j && $i != "") { 128 | $mutualFriends++; 129 | } 130 | } 131 | } 132 | return $mutualFriends; 133 | 134 | } 135 | 136 | 137 | 138 | 139 | } 140 | 141 | ?> -------------------------------------------------------------------------------- /includes/form_handlers/delete_post.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/form_handlers/login_handler.php: -------------------------------------------------------------------------------- 1 | "); 28 | } 29 | 30 | 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /includes/form_handlers/register_handler.php: -------------------------------------------------------------------------------- 1 | 0) { 59 | array_push($error_array, "Email already in use
"); 60 | } 61 | 62 | } 63 | else { 64 | array_push($error_array, "Invalid email format
"); 65 | } 66 | 67 | 68 | } 69 | else { 70 | array_push($error_array, "Emails don't match
"); 71 | } 72 | 73 | 74 | if(strlen($fname) > 25 || strlen($fname) < 2) { 75 | array_push($error_array, "Your first name must be between 2 and 25 characters
"); 76 | } 77 | 78 | if(strlen($lname) > 25 || strlen($lname) < 2) { 79 | array_push($error_array, "Your last name must be between 2 and 25 characters
"); 80 | } 81 | 82 | if($password != $password2) { 83 | array_push($error_array, "Your passwords do not match
"); 84 | } 85 | else { 86 | if(preg_match('/[^A-Za-z0-9]/', $password)) { 87 | array_push($error_array, "Your password can only contain english characters or numbers
"); 88 | } 89 | } 90 | 91 | if(strlen($password > 30 || strlen($password) < 5)) { 92 | array_push($error_array, "Your password must be betwen 5 and 30 characters
"); 93 | } 94 | 95 | 96 | if(empty($error_array)) { 97 | $password = md5($password); //Encrypt password before sending to database 98 | 99 | //Generate username by concatenating first name and last name 100 | $username = strtolower($fname . "_" . $lname); 101 | $check_username_query = mysqli_query($con, "SELECT username FROM users WHERE username='$username'"); 102 | 103 | 104 | $i = 0; 105 | //if username exists add number to username 106 | while(mysqli_num_rows($check_username_query) != 0) { 107 | $i++; //Add 1 to i 108 | $username = $username . "_" . $i; 109 | $check_username_query = mysqli_query($con, "SELECT username FROM users WHERE username='$username'"); 110 | } 111 | 112 | //Profile picture assignment 113 | $rand = rand(1, 2); //Random number between 1 and 2 114 | 115 | if($rand == 1) 116 | $profile_pic = "assets/images/profile_pics/defaults/head_deep_blue.png"; 117 | else if($rand == 2) 118 | $profile_pic = "assets/images/profile_pics/defaults/head_emerald.png"; 119 | 120 | 121 | $query = mysqli_query($con, "INSERT INTO users VALUES ('', '$fname', '$lname', '$username', '$em', '$password', '$date', '$profile_pic', '0', '0', 'no', ',')"); 122 | 123 | array_push($error_array, "You're all set! Go ahead and login!
"); 124 | 125 | //Clear session variables 126 | $_SESSION['reg_fname'] = ""; 127 | $_SESSION['reg_lname'] = ""; 128 | $_SESSION['reg_email'] = ""; 129 | $_SESSION['reg_email2'] = ""; 130 | } 131 | 132 | } 133 | ?> -------------------------------------------------------------------------------- /includes/form_handlers/settings_handler.php: -------------------------------------------------------------------------------- 1 |
"; 14 | 15 | $query = mysqli_query($con, "UPDATE users SET first_name='$first_name', last_name='$last_name', email='$email' WHERE username='$userLoggedIn'"); 16 | } 17 | else 18 | $message = "That email is already in use!

"; 19 | } 20 | else 21 | $message = ""; 22 | 23 | 24 | //************************************************** 25 | 26 | if(isset($_POST['update_password'])) { 27 | 28 | $old_password = strip_tags($_POST['old_password']); 29 | $new_password_1 = strip_tags($_POST['new_password_1']); 30 | $new_password_2 = strip_tags($_POST['new_password_2']); 31 | 32 | $password_query = mysqli_query($con, "SELECT password FROM users WHERE username='$userLoggedIn'"); 33 | $row = mysqli_fetch_array($password_query); 34 | $db_password = $row['password']; 35 | 36 | if(md5($old_password) == $db_password) { 37 | 38 | if($new_password_1 == $new_password_2) { 39 | 40 | 41 | if(strlen($new_password_1) <= 4) { 42 | $password_message = "Sorry, your password must be greater than 4 characters

"; 43 | } 44 | else { 45 | $new_password_md5 = md5($new_password_1); 46 | $password_query = mysqli_query($con, "UPDATE users SET password='$new_password_md5' WHERE username='$userLoggedIn'"); 47 | $password_message = "Password has been changed!

"; 48 | } 49 | 50 | 51 | } 52 | else { 53 | $password_message = "Your two new passwords need to match!

"; 54 | } 55 | 56 | } 57 | else { 58 | $password_message = "The old password is incorrect!

"; 59 | } 60 | 61 | } 62 | else { 63 | $password_message = ""; 64 | } 65 | 66 | 67 | if(isset($_POST['close_account'])) { 68 | header("Location: close_account.php"); 69 | } 70 | 71 | 72 | ?> -------------------------------------------------------------------------------- /includes/handlers/ajax_delete_message.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/handlers/ajax_friend_search.php: -------------------------------------------------------------------------------- 1 | getMutualFriends($row['username']) . " friends in common"; 26 | } 27 | else { 28 | $mutual_friends = ""; 29 | } 30 | 31 | if($user->isFriend($row['username'])) { 32 | echo ""; 45 | 46 | 47 | } 48 | 49 | 50 | } 51 | } 52 | 53 | ?> -------------------------------------------------------------------------------- /includes/handlers/ajax_load_messages.php: -------------------------------------------------------------------------------- 1 | getConvosDropdown($_REQUEST, $limit); 10 | 11 | ?> -------------------------------------------------------------------------------- /includes/handlers/ajax_load_notifications.php: -------------------------------------------------------------------------------- 1 | getNotifications($_REQUEST, $limit); 10 | 11 | ?> -------------------------------------------------------------------------------- /includes/handlers/ajax_load_posts.php: -------------------------------------------------------------------------------- 1 | loadPostsFriends($_REQUEST, $limit); 10 | ?> -------------------------------------------------------------------------------- /includes/handlers/ajax_load_profile_posts.php: -------------------------------------------------------------------------------- 1 | loadProfilePosts($_REQUEST, $limit); 10 | ?> -------------------------------------------------------------------------------- /includes/handlers/ajax_search.php: -------------------------------------------------------------------------------- 1 | getMutualFriends($row['username']) . " friends in common"; 28 | else 29 | $mutual_friends = ""; 30 | 31 | echo ""; 44 | 45 | } 46 | 47 | } 48 | 49 | ?> -------------------------------------------------------------------------------- /includes/handlers/ajax_submit_profile_post.php: -------------------------------------------------------------------------------- 1 | submitPost($_POST['post_body'], $_POST['user_to']); 12 | } 13 | 14 | ?> -------------------------------------------------------------------------------- /includes/handlers/logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/header.php: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | Welcome to YCONNECT 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
42 | 43 | 46 | 47 | 48 | 68 | 69 | 120 | 121 | 122 | 123 | 124 | 125 |
126 | 127 | 128 | 176 | 177 | 178 |
-------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 10000000) { 17 | $errorMessage = "Sorry your file is too large"; 18 | $uploadOk = 0; 19 | } 20 | 21 | if(strtolower($imageFileType) != "jpeg" && strtolower($imageFileType) != "png" && strtolower($imageFileType) != "jpg") { 22 | $errorMessage = "Sorry, only jpeg, jpg and png files are allowed"; 23 | $uploadOk = 0; 24 | } 25 | 26 | if($uploadOk) { 27 | if(move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $imageName)) { 28 | //image uploaded okay 29 | } 30 | else { 31 | //image did not upload 32 | $uploadOk = 0; 33 | } 34 | } 35 | 36 | } 37 | 38 | if($uploadOk) { 39 | $post = new Post($con, $userLoggedIn); 40 | $post->submitPost($_POST['post_text'], 'none', $imageName); 41 | } 42 | else { 43 | echo "
44 | $errorMessage 45 |
"; 46 | } 47 | 48 | } 49 | 50 | 51 | ?> 52 |
53 | 54 | 55 |
56 | 57 | 61 | 62 |
63 | "; 64 | echo "Likes: " . $user['num_likes']; 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 |

Popular

90 | 91 | 112 | 113 | 114 |
115 | 116 | 117 | 118 | 119 | 177 | 178 | 179 | 180 | 181 |
182 | 183 | -------------------------------------------------------------------------------- /like.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 22 | 23 | insertNotification($post_id, $user_liked, "like"); 64 | } 65 | } 66 | //Unlike button 67 | if(isset($_POST['unlike_button'])) { 68 | $total_likes--; 69 | $query = mysqli_query($con, "UPDATE posts SET likes='$total_likes' WHERE id='$post_id'"); 70 | $total_user_likes--; 71 | $user_likes = mysqli_query($con, "UPDATE users SET num_likes='$total_user_likes' WHERE username='$user_liked'"); 72 | $insert_user = mysqli_query($con, "DELETE FROM likes WHERE username='$userLoggedIn' AND post_id='$post_id'"); 73 | } 74 | 75 | //Check for previous likes 76 | $check_query = mysqli_query($con, "SELECT * FROM likes WHERE username='$userLoggedIn' AND post_id='$post_id'"); 77 | $num_rows = mysqli_num_rows($check_query); 78 | 79 | if($num_rows > 0) { 80 | echo '
81 | 82 | 85 |
86 | '; 87 | } 88 | else { 89 | echo '
90 | 91 | 94 |
95 | '; 96 | } 97 | 98 | 99 | ?> 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /messages.php: -------------------------------------------------------------------------------- 1 | getMostRecentUser(); 10 | if($user_to == false) 11 | $user_to = 'new'; 12 | } 13 | 14 | if($user_to != "new") 15 | $user_to_obj = new User($con, $user_to); 16 | 17 | if(isset($_POST['post_message'])) { 18 | 19 | if(isset($_POST['message_body'])) { 20 | $body = mysqli_real_escape_string($con, $_POST['message_body']); 21 | $date = date("Y-m-d H:i:s"); 22 | $message_obj->sendMessage($user_to, $body, $date); 23 | } 24 | 25 | } 26 | 27 | ?> 28 | 29 |
30 | 31 | 32 |
33 | 34 | 38 | 39 |
40 | "; 41 | echo "Likes: " . $user['num_likes']; 42 | 43 | ?> 44 |
45 |
46 | 47 |
48 | You and " . $user_to_obj->getFirstAndLastName() . "

"; 51 | 52 | echo "
"; 53 | echo $message_obj->getMessages($user_to); 54 | echo "
"; 55 | } 56 | else { 57 | echo "

New Message

"; 58 | } 59 | ?> 60 | 61 | 62 | 63 |
64 |
65 |
"; 68 | ?> 69 | To: 70 | 71 |
"; 73 | } 74 | else { 75 | echo ""; 76 | echo ""; 77 | } 78 | 79 | ?> 80 | 81 | 82 |
83 | 84 | 88 | 89 |
90 | 91 |
92 |

Conversations

93 | 94 |
95 | getConvos(); ?> 96 |
97 |
98 | New Message 99 | 100 |
101 | -------------------------------------------------------------------------------- /post.php: -------------------------------------------------------------------------------- 1 | 11 | 12 |
13 | 14 | 15 |
16 | 17 | 21 | 22 |
23 | "; 24 | echo "Likes: " . $user['num_likes']; 25 | 26 | ?> 27 |
28 | 29 |
30 | 31 |
32 | 33 |
34 | 35 | getSinglePost($id); 38 | ?> 39 | 40 |
41 | 42 |
-------------------------------------------------------------------------------- /profile.php: -------------------------------------------------------------------------------- 1 | removeFriend($username); 19 | } 20 | 21 | if(isset($_POST['add_friend'])) { 22 | $user = new User($con, $userLoggedIn); 23 | $user->sendRequest($username); 24 | } 25 | if(isset($_POST['respond_request'])) { 26 | header("Location: requests.php"); 27 | } 28 | 29 | if(isset($_POST['post_message'])) { 30 | if(isset($_POST['message_body'])) { 31 | $body = mysqli_real_escape_string($con, $_POST['message_body']); 32 | $date = date("Y-m-d H:i:s"); 33 | $message_obj->sendMessage($username, $body, $date); 34 | } 35 | 36 | $link = '#profileTabs a[href="#messages_div"]'; 37 | echo ""; 42 | 43 | 44 | } 45 | 46 | ?> 47 | 48 | 55 | 56 |
57 | 58 | 59 |
60 |

61 |

62 |

63 |
64 | 65 |
66 | isClosed()) { 69 | header("Location: user_closed.php"); 70 | } 71 | 72 | $logged_in_user_obj = new User($con, $userLoggedIn); 73 | 74 | if($userLoggedIn != $username) { 75 | 76 | if($logged_in_user_obj->isFriend($username)) { 77 | echo '
'; 78 | } 79 | else if ($logged_in_user_obj->didReceiveRequest($username)) { 80 | echo '
'; 81 | } 82 | else if ($logged_in_user_obj->didSendRequest($username)) { 83 | echo '
'; 84 | } 85 | else 86 | echo '
'; 87 | 88 | } 89 | 90 | ?> 91 |
92 | 93 | 94 | '; 97 | echo $logged_in_user_obj->getMutualFriends($username) . " Mutual friends"; 98 | echo '
'; 99 | } 100 | 101 | 102 | ?> 103 | 104 |
105 | 106 | 107 |
108 | 109 | 113 | 114 |
115 | 116 |
117 |
118 | 119 |
120 | 121 | 122 |
123 | You and " . $profile_user_obj->getFirstAndLastName() . "

"; 127 | 128 | echo "
"; 129 | echo $message_obj->getMessages($username); 130 | echo "
"; 131 | ?> 132 | 133 | 134 | 135 |
136 |
137 | 138 | 139 |
140 | 141 |
142 | 143 | 149 |
150 | 151 | 152 |
153 | 154 | 155 |
156 | 157 | 158 | 187 | 188 | 189 | 246 | 247 | 248 | 249 | 250 | 251 |
252 | 253 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## SOCIAL NETWORK USING PHP AND MYSQL [![](https://img.shields.io/github/license/sourcerer-io/hall-of-fame.svg?colorB=ff0000)](https://github.com/yaswanthpalaghat/Hand-Movement-Recognition-using-opencv/blob/master/LICENSE) 2 | ### Code Requirements 3 | PHP, Mysql, Javascript, Jquery and XAMPP server 4 | 5 | ### Description 6 | 7 | 8 | 9 | This is a social network which resembles the functionality like Facebook in which users can register, login, post things, chat with friends, receive notifications, search for friends , friend requests etc.. 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /register.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | Welcome to YCONNECT 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | $(document).ready(function() { 24 | $("#first").hide(); 25 | $("#second").show(); 26 | }); 27 | 28 | 29 | 30 | '; 31 | } 32 | 33 | 34 | ?> 35 | 36 |
37 | 38 | 123 | 124 |
125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /requests.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 7 |

Friend Requests

8 | 9 | getFirstAndLastName() . " sent you a friend request!"; 21 | 22 | $user_from_friend_array = $user_from_obj->getFriendArray(); 23 | 24 | if(isset($_POST['accept_request' . $user_from ])) { 25 | $add_friend_query = mysqli_query($con, "UPDATE users SET friend_array=CONCAT(friend_array, '$user_from,') WHERE username='$userLoggedIn'"); 26 | $add_friend_query = mysqli_query($con, "UPDATE users SET friend_array=CONCAT(friend_array, '$userLoggedIn,') WHERE username='$user_from'"); 27 | 28 | $delete_query = mysqli_query($con, "DELETE FROM friend_requests WHERE user_to='$userLoggedIn' AND user_from='$user_from'"); 29 | echo "You are now friends!"; 30 | header("Location: requests.php"); 31 | } 32 | 33 | if(isset($_POST['ignore_request' . $user_from ])) { 34 | $delete_query = mysqli_query($con, "DELETE FROM friend_requests WHERE user_to='$userLoggedIn' AND user_from='$user_from'"); 35 | echo "Request ignored!"; 36 | header("Location: requests.php"); 37 | } 38 | 39 | ?> 40 |
41 | 42 | 43 |
44 | 52 | 53 | 54 |
-------------------------------------------------------------------------------- /search.php: -------------------------------------------------------------------------------- 1 | 19 | 20 |
21 | 22 |
"; 51 | 52 | 53 | echo "

Try searching for:

"; 54 | echo "Names, Usernames


"; 55 | 56 | while($row = mysqli_fetch_array($usersReturnedQuery)) { 57 | $user_obj = new User($con, $user['username']); 58 | 59 | $button = ""; 60 | $mutual_friends = ""; 61 | 62 | if($user['username'] != $row['username']) { 63 | 64 | //Generate button depending on friendship status 65 | if($user_obj->isFriend($row['username'])) 66 | $button = ""; 67 | else if($user_obj->didReceiveRequest($row['username'])) 68 | $button = ""; 69 | else if($user_obj->didSendRequest($row['username'])) 70 | $button = ""; 71 | else 72 | $button = ""; 73 | 74 | $mutual_friends = $user_obj->getMutualFriends($row['username']) . " friends in common"; 75 | 76 | 77 | //Button forms 78 | if(isset($_POST[$row['username']])) { 79 | 80 | if($user_obj->isFriend($row['username'])) { 81 | $user_obj->removeFriend($row['username']); 82 | header("Location: http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); 83 | } 84 | else if($user_obj->didReceiveRequest($row['username'])) { 85 | header("Location: requests.php"); 86 | } 87 | else if($user_obj->didSendRequest($row['username'])) { 88 | 89 | } 90 | else { 91 | $user_obj->sendRequest($row['username']); 92 | header("Location: http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); 93 | } 94 | 95 | } 96 | 97 | 98 | 99 | } 100 | 101 | echo "
102 |
103 |
104 | " . $button . " 105 |
106 |
107 |
108 | 109 | 110 |
111 | 112 |
113 | 114 | " . $row['first_name'] . " " . $row['last_name'] . " 115 |

" . $row['username'] ."

116 |
117 |
118 | " . $mutual_friends ."
119 | 120 |
121 |
"; 122 | 123 | } //End while 124 | } 125 | 126 | 127 | ?> 128 | 129 | 130 | 131 |
-------------------------------------------------------------------------------- /settings.php: -------------------------------------------------------------------------------- 1 | 5 | 6 |
7 | 8 |

Account Settings

9 | "; 11 | ?> 12 |
13 | Upload new profile picture


14 | 15 | Modify the values and click 'Update Details' 16 | 17 | 25 | 26 |
27 | First Name:
28 | Last Name:
29 | Email:
30 | 31 | 32 | 33 |
34 |
35 | 36 |

Change Password

37 |
38 | Old Password:
39 | New Password:
40 | New Password Again:
41 | 42 | 43 | 44 |
45 |
46 | 47 |

Close Account

48 |
49 | 50 |
51 | 52 | 53 |
-------------------------------------------------------------------------------- /social.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.2.7.1 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: Dec 02, 2016 at 05:19 AM 7 | -- Server version: 5.6.20 8 | -- PHP Version: 5.5.15 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET time_zone = "+00:00"; 12 | 13 | 14 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 15 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 16 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 17 | /*!40101 SET NAMES utf8 */; 18 | 19 | -- 20 | -- Database: `social` 21 | -- 22 | 23 | -- -------------------------------------------------------- 24 | 25 | -- 26 | -- Table structure for table `comments` 27 | -- 28 | 29 | CREATE TABLE IF NOT EXISTS `comments` ( 30 | `id` int(11) NOT NULL, 31 | `post_body` text NOT NULL, 32 | `posted_by` varchar(60) NOT NULL, 33 | `posted_to` varchar(60) NOT NULL, 34 | `date_added` datetime NOT NULL, 35 | `removed` varchar(3) NOT NULL, 36 | `post_id` int(11) NOT NULL 37 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; 38 | 39 | -- -------------------------------------------------------- 40 | 41 | -- 42 | -- Table structure for table `friend_requests` 43 | -- 44 | 45 | CREATE TABLE IF NOT EXISTS `friend_requests` ( 46 | `id` int(11) NOT NULL, 47 | `user_to` varchar(50) NOT NULL, 48 | `user_from` varchar(50) NOT NULL 49 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ; 50 | 51 | -- -------------------------------------------------------- 52 | 53 | -- 54 | -- Table structure for table `likes` 55 | -- 56 | 57 | CREATE TABLE IF NOT EXISTS `likes` ( 58 | `id` int(11) NOT NULL, 59 | `username` varchar(60) NOT NULL, 60 | `post_id` int(11) NOT NULL 61 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ; 62 | 63 | -- -------------------------------------------------------- 64 | 65 | -- 66 | -- Table structure for table `messages` 67 | -- 68 | 69 | CREATE TABLE IF NOT EXISTS `messages` ( 70 | `id` int(11) NOT NULL, 71 | `user_to` varchar(50) NOT NULL, 72 | `user_from` varchar(50) NOT NULL, 73 | `body` text NOT NULL, 74 | `date` datetime NOT NULL, 75 | `opened` varchar(3) NOT NULL, 76 | `viewed` varchar(3) NOT NULL, 77 | `deleted` varchar(3) NOT NULL 78 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=44 ; 79 | 80 | -- -------------------------------------------------------- 81 | 82 | -- 83 | -- Table structure for table `notifications` 84 | -- 85 | 86 | CREATE TABLE IF NOT EXISTS `notifications` ( 87 | `id` int(11) NOT NULL, 88 | `user_to` varchar(50) NOT NULL, 89 | `user_from` varchar(50) NOT NULL, 90 | `message` text NOT NULL, 91 | `link` varchar(100) NOT NULL, 92 | `datetime` datetime NOT NULL, 93 | `opened` varchar(3) NOT NULL, 94 | `viewed` varchar(3) NOT NULL 95 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ; 96 | 97 | -- -------------------------------------------------------- 98 | 99 | -- 100 | -- Table structure for table `posts` 101 | -- 102 | 103 | CREATE TABLE IF NOT EXISTS `posts` ( 104 | `id` int(11) NOT NULL, 105 | `body` text NOT NULL, 106 | `added_by` varchar(60) NOT NULL, 107 | `user_to` varchar(60) NOT NULL, 108 | `date_added` datetime NOT NULL, 109 | `user_closed` varchar(3) NOT NULL, 110 | `deleted` varchar(3) NOT NULL, 111 | `likes` int(11) NOT NULL 112 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=66 ; 113 | 114 | -- -------------------------------------------------------- 115 | 116 | -- 117 | -- Table structure for table `trends` 118 | -- 119 | 120 | CREATE TABLE IF NOT EXISTS `trends` ( 121 | `title` varchar(50) NOT NULL, 122 | `hits` int(11) NOT NULL 123 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 124 | 125 | -- -------------------------------------------------------- 126 | 127 | -- 128 | -- Table structure for table `users` 129 | -- 130 | 131 | CREATE TABLE IF NOT EXISTS `users` ( 132 | `id` int(11) NOT NULL, 133 | `first_name` varchar(25) NOT NULL, 134 | `last_name` varchar(25) NOT NULL, 135 | `username` varchar(100) NOT NULL, 136 | `email` varchar(100) NOT NULL, 137 | `password` varchar(255) NOT NULL, 138 | `signup_date` date NOT NULL, 139 | `profile_pic` varchar(255) NOT NULL, 140 | `num_posts` int(11) NOT NULL, 141 | `num_likes` int(11) NOT NULL, 142 | `user_closed` varchar(3) NOT NULL, 143 | `friend_array` text NOT NULL 144 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; 145 | 146 | -- 147 | -- Indexes for dumped tables 148 | -- 149 | 150 | -- 151 | -- Indexes for table `comments` 152 | -- 153 | ALTER TABLE `comments` 154 | ADD PRIMARY KEY (`id`); 155 | 156 | -- 157 | -- Indexes for table `friend_requests` 158 | -- 159 | ALTER TABLE `friend_requests` 160 | ADD PRIMARY KEY (`id`); 161 | 162 | -- 163 | -- Indexes for table `likes` 164 | -- 165 | ALTER TABLE `likes` 166 | ADD PRIMARY KEY (`id`); 167 | 168 | -- 169 | -- Indexes for table `messages` 170 | -- 171 | ALTER TABLE `messages` 172 | ADD PRIMARY KEY (`id`); 173 | 174 | -- 175 | -- Indexes for table `notifications` 176 | -- 177 | ALTER TABLE `notifications` 178 | ADD PRIMARY KEY (`id`); 179 | 180 | -- 181 | -- Indexes for table `posts` 182 | -- 183 | ALTER TABLE `posts` 184 | ADD PRIMARY KEY (`id`); 185 | 186 | -- 187 | -- Indexes for table `users` 188 | -- 189 | ALTER TABLE `users` 190 | ADD PRIMARY KEY (`id`); 191 | 192 | -- 193 | -- AUTO_INCREMENT for dumped tables 194 | -- 195 | 196 | -- 197 | -- AUTO_INCREMENT for table `comments` 198 | -- 199 | ALTER TABLE `comments` 200 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=9; 201 | -- 202 | -- AUTO_INCREMENT for table `friend_requests` 203 | -- 204 | ALTER TABLE `friend_requests` 205 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10; 206 | -- 207 | -- AUTO_INCREMENT for table `likes` 208 | -- 209 | ALTER TABLE `likes` 210 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=25; 211 | -- 212 | -- AUTO_INCREMENT for table `messages` 213 | -- 214 | ALTER TABLE `messages` 215 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=44; 216 | -- 217 | -- AUTO_INCREMENT for table `notifications` 218 | -- 219 | ALTER TABLE `notifications` 220 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=19; 221 | -- 222 | -- AUTO_INCREMENT for table `posts` 223 | -- 224 | ALTER TABLE `posts` 225 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=66; 226 | -- 227 | -- AUTO_INCREMENT for table `users` 228 | -- 229 | ALTER TABLE `users` 230 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11; 231 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 232 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 233 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 234 | -------------------------------------------------------------------------------- /upload.php: -------------------------------------------------------------------------------- 1 | "; 69 | } 70 | //create the new resized image 71 | $main = imagecreatetruecolor($main_width,$main_height); 72 | imagecopyresampled($main,$src2,0, 0, 0, 0,$main_width,$main_height,$original_width,$original_height); 73 | //upload new version 74 | $main_temp = $fullpath_2; 75 | imagejpeg($main, $main_temp, 90); 76 | chmod($main_temp,0777); 77 | //free up memory 78 | imagedestroy($src2); 79 | imagedestroy($main); 80 | //imagedestroy($fullpath); 81 | @ unlink($fullpath); // delete the original upload 82 | 83 | }//ADD Image 84 | 85 | /*********************************************************** 86 | 3- Cropping & Converting The Image To Jpg 87 | ***********************************************************/ 88 | if (isset($_POST['x'])){ 89 | 90 | //the file type posted 91 | $type = $_POST['type']; 92 | //the image src 93 | $src = 'assets/images/profile_pics/'.$_POST['src']; 94 | $finalname = $profile_id.md5(time()); 95 | 96 | if($type == 'jpg' || $type == 'jpeg' || $type == 'JPG' || $type == 'JPEG'){ 97 | 98 | //the target dimensions 150x150 99 | $targ_w = $targ_h = 150; 100 | //quality of the output 101 | $jpeg_quality = 90; 102 | //create a cropped copy of the image 103 | $img_r = imagecreatefromjpeg($src); 104 | $dst_r = imagecreatetruecolor( $targ_w, $targ_h ); 105 | imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'], 106 | $targ_w,$targ_h,$_POST['w'],$_POST['h']); 107 | //save the new cropped version 108 | imagejpeg($dst_r, "assets/images/profile_pics/".$finalname."n.jpeg", 90); 109 | 110 | }else if($type == 'png' || $type == 'PNG'){ 111 | 112 | //the target dimensions 150x150 113 | $targ_w = $targ_h = 150; 114 | //quality of the output 115 | $jpeg_quality = 90; 116 | //create a cropped copy of the image 117 | $img_r = imagecreatefrompng($src); 118 | $dst_r = imagecreatetruecolor( $targ_w, $targ_h ); 119 | imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'], 120 | $targ_w,$targ_h,$_POST['w'],$_POST['h']); 121 | //save the new cropped version 122 | imagejpeg($dst_r, "assets/images/profile_pics/".$finalname."n.jpeg", 90); 123 | 124 | }else if($type == 'gif' || $type == 'GIF'){ 125 | 126 | //the target dimensions 150x150 127 | $targ_w = $targ_h = 150; 128 | //quality of the output 129 | $jpeg_quality = 90; 130 | //create a cropped copy of the image 131 | $img_r = imagecreatefromgif($src); 132 | $dst_r = imagecreatetruecolor( $targ_w, $targ_h ); 133 | imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'], 134 | $targ_w,$targ_h,$_POST['w'],$_POST['h']); 135 | //save the new cropped version 136 | imagejpeg($dst_r, "assets/images/profile_pics/".$finalname."n.jpeg", 90); 137 | 138 | } 139 | //free up memory 140 | imagedestroy($img_r); // free up memory 141 | imagedestroy($dst_r); //free up memory 142 | @ unlink($src); // delete the original upload 143 | 144 | //return cropped image to page 145 | $result_path ="assets/images/profile_pics/".$finalname."n.jpeg"; 146 | 147 | //Insert image into database 148 | $insert_pic_query = mysqli_query($con, "UPDATE users SET profile_pic='$result_path' WHERE username='$userLoggedIn'"); 149 | header("Location: ".$userLoggedIn); 150 | 151 | }// post x 152 | ?> 153 | 154 |
155 | 156 | 157 |
158 | 159 |

160 | 161 |
162 | Upload something

163 |

164 | 165 |


166 | 167 |
168 | 169 | 170 | 172 | 176 |
177 | 178 |
179 | 180 |
181 | 182 |
183 |

184 | Crop Profile Image

185 | 186 | Crop / resize your uploaded profile image.
187 | Once you are happy with your profile image then please click save. 188 | 189 |
190 |

191 |
192 | 193 |
194 | 195 |
196 |
197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 |
205 |
206 | 207 |
208 |
209 | 210 |
211 |
212 | 213 |
214 | 216 |
217 | 218 | 219 | 220 | 221 | 222 | 224 | 225 | 226 | 227 | 228 | 229 | 230 |

231 | -------------------------------------------------------------------------------- /user_closed.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 |

User Closed

7 | 8 | This account is closed. 9 | Click here to go back. 10 | 11 |
--------------------------------------------------------------------------------