$result = 0; if ($task == 'dosave') { $result = 1; $setting['setting_he_wall_comments_per_page'] = (int) $_POST['setting_he_wall_comments_per_page']; $setting['setting_he_wall_actions_per_page'] = (int) $_POST['setting_he_wall_actions_per_page']; $setting['setting_he_wall_guest_view'] = (int) $_POST['setting_he_wall_guest_view']; $setting['setting_he_wall_music_sync'] = (int) $_POST['setting_he_wall_music_sync']; $setting['setting_he_wall_video_sync'] = (int) $_POST['setting_he_wall_video_sync']; $setting['setting_he_wall_photo_sync'] = (int) $_POST['setting_he_wall_photo_sync']; $setting['setting_he_wall_video_player_width'] = (int) $_POST['setting_he_wall_video_player_width']; $setting['setting_he_wall_video_player_height'] = (int) $_POST['setting_he_wall_video_player_height']; $setting['setting_he_wall_video_thumb_width'] = (int) $_POST['setting_he_wall_video_thumb_width']; $setting['setting_he_wall_video_thumb_height'] = (int) $_POST['setting_he_wall_video_thumb_height']; $setting['setting_he_wall_photo_width'] = (int) $_POST['setting_he_wall_photo_width']; $setting['setting_he_wall_photo_height'] = (int) $_POST['setting_he_wall_photo_height']; $setting['setting_he_wall_photo_thumb_width'] = (int) $_POST['setting_he_wall_photo_thumb_width']; $setting['setting_he_wall_photo_thumb_height'] = (int) $_POST['setting_he_wall_photo_thumb_height']; $setting['setting_he_wall_photo_filesize'] = (int) $_POST['setting_he_wall_photo_filesize']; $setting['setting_he_wall_photo_exts'] = trim($_POST['setting_he_wall_photo_exts']); $setting['setting_he_wall_photo_mimes'] = trim($_POST['setting_he_wall_photo_mimes']); $setting['setting_he_wall_music_filesize'] = (int) $_POST['setting_he_wall_music_filesize']; $setting['setting_he_wall_music_exts'] = trim($_POST['setting_he_wall_music_exts']); $setting['setting_he_wall_music_mimes'] = trim($_POST['setting_he_wall_music_mimes']); $sql = he_database::placeholder("UPDATE `se_settings` SET \r\n `setting_he_wall_comments_per_page`=?, \r\n `setting_he_wall_actions_per_page`=?, \r\n `setting_he_wall_music_sync`=?,\r\n `setting_he_wall_video_sync`=?,\r\n `setting_he_wall_photo_sync`=?,\r\n `setting_he_wall_guest_view`=?,\r\n \r\n `setting_he_wall_video_player_width`=?,\r\n `setting_he_wall_video_player_height`=?,\r\n `setting_he_wall_video_thumb_width`=?,\r\n `setting_he_wall_video_thumb_height`=?,\r\n \r\n `setting_he_wall_photo_width`=?,\r\n `setting_he_wall_photo_height`=?,\r\n `setting_he_wall_photo_thumb_width`=?,\r\n `setting_he_wall_photo_thumb_height`=?,\r\n `setting_he_wall_photo_filesize`=?,\r\n `setting_he_wall_photo_exts`='?',\r\n `setting_he_wall_photo_mimes`='?',\r\n \r\n `setting_he_wall_music_filesize`=?,\r\n `setting_he_wall_music_exts`='?',\r\n `setting_he_wall_music_mimes`='?'", $setting['setting_he_wall_comments_per_page'], $setting['setting_he_wall_actions_per_page'], $setting['setting_he_wall_music_sync'], $setting['setting_he_wall_video_sync'], $setting['setting_he_wall_photo_sync'], $setting['setting_he_wall_guest_view'], $setting['setting_he_wall_video_player_width'], $setting['setting_he_wall_video_player_height'], $setting['setting_he_wall_video_thumb_width'], $setting['setting_he_wall_video_thumb_height'], $setting['setting_he_wall_photo_width'], $setting['setting_he_wall_photo_height'], $setting['setting_he_wall_photo_thumb_width'], $setting['setting_he_wall_photo_thumb_height'], $setting['setting_he_wall_photo_filesize'], $setting['setting_he_wall_photo_exts'], $setting['setting_he_wall_photo_mimes'], $setting['setting_he_wall_music_filesize'], $setting['setting_he_wall_music_exts'], $setting['setting_he_wall_music_mimes']); he_database::query($sql); } $smarty->assign('music_plugin_installed', $music_plugin_installed); $smarty->assign('album_plugin_installed', $album_plugin_installed); $smarty->assign('video_plugin_installed', $video_plugin_installed); $smarty->assign('result', $result); include "admin_footer.php";
function get_users($user_ids) { if (!$user_ids) { return array(); } $user_ids_str = implode(',', $user_ids); $sql = "SELECT `user_id`, `user_username`, `user_fname`, `user_lname`, `user_photo` FROM `se_users`\r\n \tWHERE `user_id` IN ({$user_ids_str})"; $user_list = array(); $res = he_database::query($sql); while ($row = he_database::fetch_row_from_resource($res)) { $author = new se_user(); $author->user_exists = 1; $author->user_info['user_id'] = $row['user_id']; $author->user_info['user_username'] = $row['user_username']; $author->user_info['user_fname'] = $row['user_fname']; $author->user_info['user_lname'] = $row['user_lname']; $author->user_info['user_photo'] = $row['user_photo']; $author->user_displayname(); $user_list[$row['user_id']] = $author; } return $user_list; }
/** * Checks if module has db structure and if it is needed upgrade or not * * @return void; */ function check_db_structure() { global $settings; $file_version = $this->get_version(); //check if db structure is ready if( !$settings['he_mass_mailing_version'] ) { if( !he_database::fetch_row("SHOW COLUMNS FROM se_settings LIKE 'he_mass_mailing_version'") ) { he_database::query("ALTER TABLE `se_settings` ADD `he_mass_mailing_version` int(10) NOT NULL DEFAULT $file_version"); he_database::query("ALTER TABLE `se_settings` ADD `he_mass_mailing_last_execute` int(10) NOT NULL"); he_database::query("ALTER TABLE `se_settings` ADD `he_mass_mailing_limit_per_execute` int(10) NOT NULL DEFAULT 30"); he_database::query("CREATE TABLE `se_he_mass_mailing_campaign` (`id` int(11) NOT NULL AUTO_INCREMENT,`subject` varchar(255) NOT NULL,`message` text NOT NULL,`sender` int(10) NOT NULL,`sent_time` int(10) unsigned NOT NULL,`is_email` tinyint(1) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); he_database::query("CREATE TABLE `se_he_mass_mailing_queue` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,`campaign_id` int(11) NOT NULL,`recipient` int(10) NOT NULL,`email` varchar(64) NOT NULL,`full_name` varchar(128) NOT NULL,`replace` text NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); $settings['he_mass_mailing_version'] = $file_version; } } //check db and file version if( $file_version > $settings['he_mass_mailing_version'] ) { //db version is older than file so we have to upgrade db version switch( $settings['he_mass_mailing_version'] ) { case 101: break; } } }
function recent_taked_quizzes($count = 10) { $query = he_database::placeholder("SELECT `play`.`user_id` AS `play_user_id`, `play`.`play_stamp`, `quiz`.*\r\n\t\t\tFROM `se_he_quiz_play` AS `play`\r\n\t\t\tINNER JOIN ( \r\n\t\t\t SELECT MAX(`play_stamp`) AS `play_stamp` FROM `se_he_quiz_play`\r\n\t\t\t WHERE `play_stamp`!=0\r\n\t\t\t GROUP BY `quiz_id`\r\n\t\t\t) AS `last` ON (`play`.`play_stamp`=`last`.`play_stamp`)\r\n\t\t\tINNER JOIN `se_he_quiz` AS `quiz` ON (`play`.`quiz_id`=`quiz`.`quiz_id`)\r\n\t\t\tWHERE `quiz`.approved = 1 AND `quiz`.`status`=1\r\n\t\t\tLIMIT ?", $count); $takes = array(); $res = he_database::query($query); $quiz_arr = array(); while ($quiz = he_database::fetch_row_from_resource($res)) { $quiz['user'] = new se_user(array($quiz['play_user_id'])); $quiz['photo_url'] = $quiz['photo'] ? he_quiz::photo_url() . $quiz['photo'] : ''; $quiz_arr[$quiz['quiz_id']] = $quiz; } return $quiz_arr; }
function placeholder() { $arguments = func_get_args(); $c_query = array_shift($arguments); if (!is_array($c_query)) { $c_query = he_database::compile_placeholder($c_query); } $query = ''; foreach ($c_query as $piece) { if (!is_array($piece)) { $query .= $piece; continue; } list($index, $type) = $piece; if (isset($piece[2])) { $array = $arguments[$index]; switch ($type) { case '"': case "'": case '`': $query .= implode("{$type},{$type}", array_map(array(__CLASS__, 'real_escape'), $array)); break; default: $query .= implode(",", array_map('intval', $array)); break; } } else { $var = $arguments[$index]; switch ($type) { case '"': case "'": case '`': $query .= he_database::real_escape($var); break; default: $query .= (int) $var; break; } } } return $query; }
<?php $page = "wall_action"; include "header.php"; if (isset($_POST['id'])) { $action_id = $_POST['id']; } elseif (isset($_GET['id'])) { $action_id = $_GET['id']; } $where_clause = he_database::placeholder("se_actions.action_id=?", $action_id); $wall_action = he_wall::actions_display(0, $setting['setting_actions_actionsonprofile'], $where_clause); $wall_action = $wall_action[0]; if (!$setting['setting_he_wall_guest_view'] && $user->level_info['level_wall_allowed'] == 0) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 690706102); $smarty->assign('error_submit', 641); include "footer.php"; } $action_info = he_wall::get_action_info($action_id); if (!$action_info) { he_wall::delete_action_notify($action_id); } if (!$wall_action) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 690706081); $smarty->assign('error_submit', 641); include "footer.php"; } $action_wall_owner = he_wall::get_wall_owner($action_info['action_object_owner'], $action_info['action_object_owner_id']);
function get_user_uploads() { $query = he_database::placeholder("SELECT * FROM `se_he_uploads`\r\n WHERE `uploads_user_id`=? AND `uploads_instance_type`='?'", $this->user_id, $this->instance_type); return he_database::fetch_array($query); }
exit; } // SET RESULT VARIABLE $result = 0; if ($task == "dosave") { $level_info['level_wall_allowed'] = $_POST['level_wall_allowed']; $level_info['level_wall_action_privacy'] = is_array($_POST['level_wall_action_privacy']) ? $_POST['level_wall_action_privacy'] : array(); //GET PRIVACY AND PRIVACY DIFFERENCES if (empty($level_info['level_wall_action_privacy']) || !is_array($level_info['level_wall_action_privacy'])) { $level_info['level_wall_action_privacy'] = array(63); } rsort($level_info['level_wall_action_privacy']); $new_privacy_options = $level_info['level_wall_action_privacy']; $level_info['level_wall_action_privacy'] = serialize($level_info['level_wall_action_privacy']); $query = he_database::placeholder("UPDATE `se_levels` SET `level_wall_allowed`=?, `level_wall_action_privacy`='?'\r\n WHERE `level_id`=?", $level_info['level_wall_allowed'], $level_info['level_wall_action_privacy'], $level_id); he_database::query($query); $result = 1; } // GET PREVIOUS PRIVACY SETTINGS $privacy_options = array(); for ($c = 6; $c > 0; $c--) { $priv = pow(2, $c) - 1; if (user_privacy_levels($priv) != "" && $priv != 1) { SE_Language::_preload(user_privacy_levels($priv)); $privacy_options[$priv] = user_privacy_levels($priv); } } // ASSIGN VARIABLES AND SHOW ADMIN ADD USER LEVEL PAGE $smarty->assign('result', $result); $smarty->assign('level_wall_action_privacy', unserialize($level_info['level_wall_action_privacy'])); $smarty->assign('privacy_options', $privacy_options);
function delete_he_wall_action() { $sql = "DELETE FROM se_he_wall_comment WHERE action_id NOT IN (SELECT action_id FROM se_actions)"; he_database::query($sql); $sql = "DELETE FROM se_he_wall_hidden_action WHERE action_id NOT IN (SELECT action_id FROM se_actions)"; he_database::query($sql); $sql = "DELETE FROM se_he_wall_like WHERE action_id NOT IN (SELECT action_id FROM se_actions)"; he_database::query($sql); he_wall::delete_action_uploads(); }
<?php $page = "browse_quiz"; include "header.php"; $current_page = isset($_GET['page']) && $_GET['page'] ? (int) $_GET['page'] : 1; $mode = isset($_GET['mode']) && $_GET['mode'] ? trim($_GET['mode']) : 'popular'; $cat_id = isset($_GET['cat_id']) && $_GET['cat_id'] ? (int) $_GET['cat_id'] : 0; //TODO get from configs $on_page = 10; $pages = 5; $first = ($current_page - 1) * $on_page; $where_cond = $cat_id != 0 ? he_database::placeholder("AND `quiz`.`cat_id`=?", $cat_id) : ''; if ($mode != 'commented') { $quiz_arr = he_quiz::quiz_list($first, $on_page, $mode, $where_cond); $quiz_total = he_quiz::quiz_total($where_cond); } else { $quiz_arr = he_quiz::recent_commented_list($first, $on_page, $where_cond); $quiz_total = he_quiz::recent_commented_total($where_cond); } $quiz_cats = he_quiz::find_cats($where_cond); $taked_quiz_list = he_quiz::recent_taked_quizzes(); $smarty->assign('mode', $mode); $smarty->assign('current_page', $current_page); $smarty->assign('quiz_arr', $quiz_arr); $smarty->assign('message', $message); $smarty->assign('paging', array('total' => $quiz_total, 'on_page' => $on_page, 'pages' => $pages)); $smarty->assign('quiz_cats', $quiz_cats); $smarty->assign('taked_quiz_list', $taked_quiz_list); $smarty->assign('cat_id', $cat_id); include "footer.php";