Exemplo n.º 1
0
 public function get_users_reputation_topic($uids, $users_reputation, $limit = 10)
 {
     if ($users_reputation_topics = $this->model('reputation')->get_reputation_topic($uids)) {
         foreach ($users_reputation_topics as $key => $val) {
             if ($val['reputation'] < 1 or $val['agree_count'] < 1) {
                 continue;
             }
             $reputation_topics[$val['uid']][] = $val;
         }
     }
     if ($reputation_topics) {
         foreach ($reputation_topics as $uid => $reputation_topic) {
             $reputation_topic = array_slice(aasort($reputation_topic, 'reputation', 'DESC'), 0, $limit);
             foreach ($reputation_topic as $key => $val) {
                 $topic_ids[$val['topic_id']] = $val['topic_id'];
             }
             foreach ($reputation_topic as $key => $val) {
                 $reputation_topic[$key]['topic_title'] = $topics[$val['topic_id']]['topic_title'];
                 $reputation_topic[$key]['url_token'] = $topics[$val['topic_id']]['url_token'];
             }
             $reputation_topics[$uid] = $reputation_topic;
         }
         $topics = $this->model('topic')->get_topics_by_ids($topic_ids);
         foreach ($reputation_topics as $uid => $reputation_topic) {
             foreach ($reputation_topic as $key => $val) {
                 $reputation_topics[$uid][$key]['topic_title'] = $topics[$val['topic_id']]['topic_title'];
                 $reputation_topics[$uid][$key]['url_token'] = $topics[$val['topic_id']]['url_token'];
             }
         }
     }
     return $reputation_topics;
 }
Exemplo n.º 2
0
function char_skill(&$sqlr, &$sqlc)
{
    global $lang_global, $lang_char, $output, $realm_id, $realm_db, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $skill_datasite;
    wowhead_tt();
    require_once 'core/char/char_security.php';
    $order_by = isset($_GET['order_by']) ? $sqlc->quote_smart($_GET['order_by']) : 1;
    $dir = isset($_GET['dir']) ? $sqlc->quote_smart($_GET['dir']) : 1;
    if (preg_match('/^[01]{1}$/', $dir)) {
    } else {
        $dir = 1;
    }
    $order_dir = $dir ? 'ASC' : 'DESC';
    $dir = $dir ? 0 : 1;
    $result = $sqlc->query('SELECT account, name, race, class, level, gender FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT `username`, `gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $owner_acc_id . ' ORDER BY `gmlevel` DESC LIMIT 1');
        $owner_name = $sqlr->result($result, 0, 'username');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        if (empty($owner_gmlvl)) {
            $owner_gmlvl = 0;
        }
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $result = $sqlc->query('SELECT name, race, class, level, gender FROM characters WHERE guid = ' . $id . '');
            $char = $sqlc->fetch_assoc($result);
            $output .= '
                                <center>
                                    <div id="tab_content">
                                        <h1>' . $lang_char['skills'] . '</h1>
                                        <br />';
            require_once 'core/char/char_header.php';
            $output .= '
                                        <br /><br />
                                        <table class="lined" style="width: 550px;">
                                            <tr>
                                                <th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['skills'] . '</th>
                                            </tr>
                                            <tr>
                                                ' . ($user_lvl ? '<th><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_id'] . '</a></th>' : '') . '
                                                <th align="right"><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_name'] . '</a></th>
                                                <th><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_value'] . '</a></th>
                                            </tr>';
            $skill_array = array();
            $class_array = array();
            $prof_1_array = array();
            $prof_2_array = array();
            $weapon_array = array();
            $armor_array = array();
            $language_array = array();
            $skill_rank_array = array(75 => $lang_char['apprentice'], 150 => $lang_char['journeyman'], 225 => $lang_char['expert'], 300 => $lang_char['artisan'], 375 => $lang_char['master'], 450 => $lang_char['inherent'], 385 => $lang_char['wise']);
            $result = $sqlc->query('SELECT skill, value, max FROM character_skills WHERE guid = ' . $id . '');
            $sqlm = new SQL();
            $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
            while ($char_skill = $sqlc->fetch_assoc($result)) {
                $temp = $char_skill['value'];
                $skill = $char_skill['skill'];
                $max = $char_skill['max'];
                if (skill_get_type($skill, $sqlm) == 6) {
                    array_push($weapon_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 7) {
                    array_push($class_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 8) {
                    array_push($armor_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 9) {
                    array_push($prof_2_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 10) {
                    array_push($language_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 11) {
                    array_push($prof_1_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } else {
                    array_push($skill_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                }
            }
            unset($char_skill);
            aasort($skill_array, $order_by, $dir);
            aasort($class_array, $order_by, $dir);
            aasort($prof_1_array, $order_by, $dir);
            aasort($prof_2_array, $order_by, $dir);
            aasort($weapon_array, $order_by, $dir);
            aasort($armor_array, $order_by, $dir);
            aasort($language_array, $order_by, $dir);
            foreach ($skill_array as $data) {
                $output .= '
                                                <tr>
                                                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                                                    <td align="right">' . $data[1] . '</td>
                                                    <td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
                                                        <span>' . $data[2] . '/' . $data[3] . '</span>
                                                    </td>
                                                </tr>';
            }
            if (count($class_array)) {
                $output .= '
                                                <tr>
                                                    <th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['classskills'] . '</th>
                                                </tr>';
            }
            foreach ($class_array as $data) {
                $output .= '
                                                <tr>
                                                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                                                    <td align="right"><a href="' . $skill_datasite . '7.' . $char['class'] . '.' . $data[0] . '" target="_blank">' . $data[1] . '</td>
                                                    <td valign="center" class="bar skill_bar" style="background-position: 0px;">
                                                    </td>
                                                </tr>';
            }
            if (count($prof_1_array)) {
                $output .= '
                                                <tr>
                                                    <th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['professions'] . '</th>
                                                </tr>';
            }
            foreach ($prof_1_array as $data) {
                $output .= '
                                                <tr>
                                                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                                                    <td align="right"><a href="' . $skill_datasite . '11.' . $data[0] . '" target="_blank">' . $data[1] . '</a></td>
                                                    <td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
                                                        <span>' . $data[2] . '/' . $data[3] . ' (' . $skill_rank_array[$data[3]] . ')</span>
                                                    </td>
                                                </tr>';
            }
            if (count($prof_2_array)) {
                $output .= '
                                                <tr>
                                                    <th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['secondaryskills'] . '</th>
                                                </tr>';
            }
            foreach ($prof_2_array as $data) {
                $output .= '
                                                <tr>
                                                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                                                    <td align="right"><a href="' . $skill_datasite . '9.' . $data[0] . '" target="_blank">' . $data[1] . '</a></td>
                                                    <td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
                                                        <span>' . $data[2] . '/' . $data[3] . ' (' . $skill_rank_array[$data[3]] . ')</span>
                                                    </td>
                                                </tr>';
            }
            if (count($weapon_array)) {
                $output .= '
                                                <tr>
                                                    <th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['weaponskills'] . '</th>
                                                </tr>';
            }
            foreach ($weapon_array as $data) {
                $output .= '
                                                <tr>
                                                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                                                    <td align="right">' . $data[1] . '</td>
                                                    <td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
                                                        <span>' . $data[2] . '/' . $data[3] . '</span>
                                                    </td>
                                                </tr>';
            }
            if (count($armor_array)) {
                $output .= '
                                                <tr>
                                                    <th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['armorproficiencies'] . '</th>
                                                </tr>';
            }
            foreach ($armor_array as $data) {
                $output .= '
                                                <tr>
                                                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                                                    <td align="right">' . $data[1] . '</td>
                                                    <td valign="center" class="bar skill_bar" style="background-position: 0px;">
                                                    </td>
                                                </tr>';
            }
            if (count($language_array)) {
                $output .= '
                                                <tr>
                                                    <th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['languages'] . '</th>
                                                </tr>';
            }
            foreach ($language_array as $data) {
                $output .= '
                                                <tr>
                                                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                                                    <td align="right">' . $data[1] . '</td>
                                                    <td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
                                                        <span>' . $data[2] . '/' . $data[3] . '</span>
                                                    </td>
                                                </tr>';
            }
            $output .= '
                                            </table>
                                            <br />
                                        </div>
                                        <br />
                                    </div>
                                    <br />';
            require_once 'core/char/char_footer.php';
            $output .= '
                                    <br />
                                </center>
                                <!-- end of char_achieve.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Exemplo n.º 3
0
function char_skill(&$sqlr, &$sqlc)
{
    global $lang_global, $lang_char, $output, $realm_id, $realm_db, $characters_db, $mmfpm_db, $action_permission, $user_lvl, $user_name, $skill_datasite;
    // this page uses wowhead tooltops
    wowhead_tt();
    //==========================$_GET and SECURE=================================
    // id and multi realm security to prevent sql injection
    require_once './include/char/include/char_multi_realm_security.php';
    $order_by = isset($_GET['order_by']) ? $sqlc->quote_smart($_GET['order_by']) : 1;
    $dir = isset($_GET['dir']) ? $sqlc->quote_smart($_GET['dir']) : 1;
    if (preg_match('/^[01]{1}$/', $dir)) {
    } else {
        $dir = 1;
    }
    $order_dir = $dir ? 'ASC' : 'DESC';
    $dir = $dir ? 0 : 1;
    //==========================$_GET and SECURE end=============================
    // getting character data from database
    $result = $sqlc->query('
		SELECT account, name, race, class, gender, level
		FROM characters
		WHERE guid = ' . $id . '
		LIMIT 1');
    // no point going further if character does not exist
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('
			SELECT gmlevel, username 
			FROM account 
			WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        // check user permission
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            // character sub header
            $output .= '
<center>
<div id="tab_content">
	<h1>' . $lang_char['skills'] . '</h1>
	<br />';
            // character menu tab
            require_once './include/char/include/char_header.php';
            // character info
            require_once './include/char/include/char_info.php';
            //---------------Page Specific Data Starts Here--------------------------
            $output .= '
	<div id="tab_content2">
		<table class="lined" style="width: 700px;">
			<tr>
				<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['skills'] . '</th>
			</tr>
			<tr>
				' . ($user_lvl ? '<th><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_id'] . '</a></th>' : '') . '
				<th align="right"><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_name'] . '</a></th>
				<th><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['skill_value'] . '</a></th>
			</tr>';
            $skill_array = array();
            $class_array = array();
            $prof_1_array = array();
            $prof_2_array = array();
            $weapon_array = array();
            $armor_array = array();
            $language_array = array();
            $skill_rank_array = array(1 => $lang_char['none'], 350 => $lang_char['none'], 75 => $lang_char['apprentice'], 150 => $lang_char['journeyman'], 225 => $lang_char['expert'], 300 => $lang_char['artisan'], 375 => $lang_char['master'], 450 => $lang_char['grand_master'], 525 => $lang_char['illustrious']);
            $result = $sqlc->query('
				SELECT skill, value, max
				FROM character_skills
				WHERE guid = ' . $id . '');
            $sqlm = new SQL();
            $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
            while ($char_skill = $sqlc->fetch_assoc($result)) {
                $temp = $char_skill['value'];
                $skill = $char_skill['skill'];
                $max = $char_skill['max'];
                if (skill_get_type($skill, $sqlm) == 6) {
                    array_push($weapon_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 7) {
                    array_push($class_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 8) {
                    array_push($armor_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 9) {
                    array_push($prof_2_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 10) {
                    array_push($language_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } elseif (skill_get_type($skill, $sqlm) == 11) {
                    array_push($prof_1_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                } else {
                    array_push($skill_array, array($user_lvl ? $skill : '', skill_get_name($skill, $sqlm), $temp, $max));
                }
            }
            unset($char_skill);
            aasort($skill_array, $order_by, $dir);
            aasort($class_array, $order_by, $dir);
            aasort($prof_1_array, $order_by, $dir);
            aasort($prof_2_array, $order_by, $dir);
            aasort($weapon_array, $order_by, $dir);
            aasort($armor_array, $order_by, $dir);
            aasort($language_array, $order_by, $dir);
            foreach ($skill_array as $data) {
                $output .= '
			<tr>
				' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
				<td align="right">' . $data[1] . '</td>
				<td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
					<span>' . $data[2] . '/' . $data[3] . '</span>
				</td>
			</tr>';
            }
            if (count($class_array)) {
                $output .= '
			<tr>
				<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['classskills'] . '</th>
			</tr>';
            }
            foreach ($class_array as $data) {
                $output .= '
			<tr>
				' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
				<td align="right"><a href="' . $skill_datasite . '7.' . $char['class'] . '.' . $data[0] . '" target="_blank">' . $data[1] . '</td>
				<td valign="center" class="bar skill_bar" style="background-position: 0px;"></td>
			</tr>';
            }
            if (count($prof_1_array)) {
                $output .= '
			<tr>
				<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['professions'] . '</th>
			</tr>';
            }
            foreach ($prof_1_array as $data) {
                $output .= '
			<tr>
				' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
				<td align="right"><a href="' . $skill_datasite . '11.' . $data[0] . '" target="_blank">' . $data[1] . '</a></td>
				<td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
					<span>' . $data[2] . '/' . $data[3] . ' (' . $skill_rank_array[$data[3]] . ')</span>
				</td>
			</tr>';
            }
            if (count($prof_2_array)) {
                $output .= '
			<tr>
				<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['secondaryskills'] . '</th>
			</tr>';
            }
            foreach ($prof_2_array as $data) {
                $output .= '
			<tr>
				' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
				<td align="right"><a href="' . $skill_datasite . '9.' . $data[0] . '" target="_blank">' . $data[1] . '</a></td>
				<td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
					<span>' . $data[2] . '/' . $data[3] . ' (' . $skill_rank_array[$data[3]] . ')</span>
				</td>
			</tr>';
            }
            if (count($weapon_array)) {
                $output .= '
			<tr>
				<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['weaponskills'] . '</th>
			</tr>';
            }
            foreach ($weapon_array as $data) {
                $output .= '
			<tr>
				' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
				<td align="right">' . $data[1] . '</td>
				<td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
					<span>' . $data[2] . '/' . $data[3] . '</span>
				</td>
			</tr>';
            }
            if (count($armor_array)) {
                $output .= '
			<tr>
				<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['armorproficiencies'] . '</th>
			</tr>';
            }
            foreach ($armor_array as $data) {
                $output .= '
			<tr>
				' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
				<td align="right">' . $data[1] . '</td>
				<td valign="center" class="bar skill_bar" style="background-position: 0px;"></td>
			</tr>';
            }
            if (count($language_array)) {
                $output .= '
			<tr>
				<th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . $lang_char['languages'] . '</th>
			</tr>';
            }
            foreach ($language_array as $data) {
                $output .= '
			<tr>
				' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
				<td align="right">' . $data[1] . '</td>
				<td valign="center" class="bar skill_bar" style="background-position: ' . (round(450 * $data[2] / $data[3]) - 450) . 'px;">
					<span>' . $data[2] . '/' . $data[3] . '</span>
				</td>
			</tr>';
            }
            $output .= '
		</table>
	</div>
</div>
<br />';
            //---------------Page Specific Data Ends here----------------------------
            // character sub footer
            require_once './include/char/include/char_ footer.php';
            $output .= '
<br />
</center>';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Exemplo n.º 4
0
 public function search_articles($q, $topic_ids = null, $page = 1, $limit = 20, $is_recommend = false)
 {
     if ($topic_ids) {
         $topic_ids = explode(',', $topic_ids);
         array_walk_recursive($topic_ids, 'intval_string');
         $where[] = '`id` IN (SELECT `item_id` FROM ' . $this->get_table('topic_relation') . ' WHERE topic_id IN(' . implode(',', $topic_ids) . ') AND `type` = "article")';
     }
     if ($is_recommend) {
         $where[] = '(`is_recommend` = "1" OR `chapter_id` IS NOT NULL)';
     }
     if ($where) {
         $where = implode(' AND ', $where);
     }
     $search_hash = $this->get_search_hash('article', 'title', $q, $where);
     if (!($result = $this->fetch_cache($search_hash))) {
         if ($result = $this->query_all($this->bulid_query('article', 'title', $q, $where), $this->max_results)) {
             $result = aasort($result, 'score', 'DESC');
         } else {
             return false;
         }
         $this->save_cache($search_hash, $result);
     }
     if (!$page) {
         $slice_offset = 0;
     } else {
         $slice_offset = ($page - 1) * $limit;
     }
     return array_slice($result, $slice_offset, $limit);
 }
Exemplo n.º 5
0
 /**
  * Compute trends in the values of a field.
  *
  * @param object $req Request data
  * @param object $query ES query
  * @param object $return Partial response
  * @return object Response to request
  */
 protected function trendField($req, $query, $return, $result)
 {
     $field = self::canonicalFieldName($req->analyze_field);
     // Scale samples. If analyze_limit is more than 50% of the
     // results, then change size to 50% of the results to avoid
     // overlap
     $analyze_limit = $this->config['analyze_limit'];
     $query->size = $analyze_limit;
     if ($return->hits < $analyze_limit * 2) {
         $query->size = $return->hits / 2;
     }
     $result = $this->esQuery($query);
     $analyze = self::collectFieldValues($result->hits->hits, $field);
     unset($result);
     $analyze = array_count_values($analyze);
     $query->sort->{'@timestamp'}->order = 'asc';
     $result = $this->esQuery($query);
     $return->analysis->count = count($result->hits->hits);
     $analyze2 = self::collectFieldValues($result->hits->hits, $field);
     unset($result);
     $analyze2 = array_count_values($analyze2);
     $final = array();
     foreach ($analyze as $key => $value) {
         $first = isset($analyze2[$key]) ? $analyze2[$key] : 0;
         $final[$key] = array();
         $final[$key]['count'] = $value;
         $final[$key]['start'] = $first;
         $final[$key]['trend'] = round(($value / $query->size - $first / $query->size) * 100, 2);
         $final[$key]['abs'] = abs($final[$key]['trend']);
     }
     aasort($final, "abs");
     $final = array_slice($final, 0, $this->config['analyze_show'], true);
     $return->analysis->results = $final;
     return $return;
 }
Exemplo n.º 6
0
function event_sorting_by_date()
{
    query_posts(array('post_type' => 'events', 'post_status' => 'publish'));
    $dates_array = array();
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $data = array('post_id' => get_the_ID(), 'start_date' => get_field('start_date'), 'end_date' => get_field('end_date'));
            array_push($dates_array, $data);
        }
        wp_reset_query();
        aasort($dates_array, 'start_date');
        return $dates_array;
    }
    return 0;
}
    echo round($project['over_budget']);
    ?>
%</td>
					</tr>
					
					<?php 
}
?>
				</tbody>
			</table>
		</div>
	</div>

	<div class="span6">
		<?php 
aasort($projects, 'hours_over_budget');
$projects = array_reverse($projects, true);
?>

		<h2>Grootste verlies</h2>
		
		<div class="panel">
			<table class="table table-striped table-bordered table-condense">
				<thead>
					<tr>
						<th><?php 
_e('Project', 'orbis');
?>
</th>
						<th><?php 
_e('Aantal uren over budget', 'orbis');
Exemplo n.º 8
0
 function get_exercise_dataFN($id_course_instance, $id_student = "")
 {
     $dh = $GLOBALS['dh'];
     $out_fields_ar = array('ID_NODO', 'ID_ISTANZA_CORSO', 'DATA_VISITA', 'PUNTEGGIO', 'COMMENTO', 'CORREZIONE_RISPOSTA_LIBERA');
     $dataHa = $dh->find_ex_history_list($out_fields_ar, $this->id_user, $id_course_instance);
     if (AMA_DataHandler::isError($dataHa) || empty($dataHa)) {
         $this->user_ex_historyAr = '';
     } else {
         aasort($dataHa, array("-1"));
         $this->user_ex_historyAr = $dataHa;
     }
 }
Exemplo n.º 9
0
 public function calculate_by_uid($uid)
 {
     if (!($user_info = $this->model('account')->get_user_info_by_uid($uid))) {
         return false;
     }
     if ($user_articles = $this->query_all('SELECT id FROM ' . get_table('article') . ' WHERE uid = ' . $user_info['uid'])) {
         foreach ($user_articles as $articles_key => $articles_val) {
             $articles_ids[] = $articles_val['id'];
         }
         if ($articles_ids) {
             $articles_vote_agree_users = $this->model('article')->get_article_vote_by_ids('article', $articles_ids, 1);
             $articles_vote_against_users = $this->model('article')->get_article_vote_by_ids('article', $articles_ids, -1);
             if ($article_topics_query = $this->query_all('SELECT item_id, topic_id FROM ' . get_table('topic_relation') . ' WHERE item_id IN(' . implode(',', $articles_ids) . ") AND `type` = 'article'")) {
                 foreach ($article_topics_query as $article_topics_key => $article_topics_val) {
                     $article_topics[$article_topics_val['item_id']][] = $article_topics_val;
                 }
                 unset($article_topics_query);
             }
         }
         foreach ($user_articles as $articles_key => $articles_val) {
             // 赞同的用户
             if ($articles_vote_agree_users[$articles_val['id']]) {
                 foreach ($articles_vote_agree_users[$articles_val['id']] as $articles_vote_agree_user) {
                     $s_agree_value = $s_agree_value + $articles_vote_agree_user['reputation_factor'];
                 }
             }
             // 反对的用户
             if ($articles_vote_against_users[$articles_val['id']]) {
                 foreach ($articles_vote_against_users[$articles_val['id']] as $articles_vote_against_user) {
                     $s_against_value = $s_against_value + $articles_vote_against_user['reputation_factor'];
                 }
             }
         }
         $article_reputation = $s_agree_value - $s_against_value;
         $reputation_log_factor = get_setting('reputation_log_factor');
         if ($article_reputation < 0) {
             $article_reputation = 0 - $article_reputation - 0.5;
             if ($reputation_log_factor > 1) {
                 $article_reputation = 0 - log($article_reputation, $reputation_log_factor);
             }
         } else {
             if ($article_reputation > 0) {
                 $article_reputation = $article_reputation + 0.5;
                 if ($reputation_log_factor > 1) {
                     $article_reputation = log($article_reputation, $reputation_log_factor);
                 }
             }
         }
         // 计算在话题中的威望
         if ($article_reputation) {
             if ($article_topics[$articles_val['id']]) {
                 foreach ($article_topics[$articles_val['id']] as $key => $topic_info) {
                     $user_topics[$topic_info['topic_id']] = array('topic_id' => $topic_info['topic_id'], 'count' => intval($user_topics[$topic_info['topic_id']]['count']) + 1, 'agree_count' => intval($user_topics[$topic_info['topic_id']]['agree_count']) + sizeof($articles_vote_agree_users[$articles_val['id']]), 'thanks_count' => 0, 'reputation' => $user_topics[$topic_info['topic_id']]['reputation'] + $article_reputation);
                 }
             }
         }
         $user_reputation = $user_reputation + $article_reputation;
     }
     if ($users_anwsers = $this->query_all('SELECT answer_id, question_id, agree_count, thanks_count FROM ' . get_table('answer') . ' WHERE uid = ' . $user_info['uid'])) {
         foreach ($users_anwsers as $anwsers_key => $answers_val) {
             $answer_ids[] = $answers_val['answer_id'];
             $question_ids[] = $answers_val['question_id'];
         }
         if ($question_ids) {
             if ($questions_info_query = $this->query_all('SELECT question_id, best_answer, published_uid, category_id FROM ' . get_table('question') . ' WHERE question_id IN(' . implode(',', $question_ids) . ')')) {
                 foreach ($questions_info_query as $questions_info_key => $questions_info_val) {
                     $questions_info[$questions_info_val['question_id']] = $questions_info_val;
                 }
                 unset($questions_info_query);
             }
             if ($question_topics_query = $this->query_all('SELECT item_id, topic_id FROM ' . get_table('topic_relation') . ' WHERE item_id IN(' . implode(',', $question_ids) . ") AND `type` = 'question'")) {
                 foreach ($question_topics_query as $question_topics_key => $question_topics_val) {
                     $question_topics[$question_topics_val['item_id']][] = $question_topics_val;
                 }
                 unset($question_topics_query);
             }
         }
         if ($answer_ids) {
             $vote_agree_users = $this->model('answer')->get_vote_agree_by_answer_ids($answer_ids);
             $vote_against_users = $this->model('answer')->get_vote_against_by_answer_ids($answer_ids);
         }
         foreach ($users_anwsers as $answers_key => $answers_val) {
             if (!$questions_info[$answers_val['question_id']]) {
                 continue;
             }
             $answer_reputation = 0;
             // 回复威望系数
             $s_publisher_agree = 0;
             // 得到发起者赞同
             $s_publisher_against = 0;
             // 得道发起者反对
             $s_agree_value = 0;
             // 赞同威望系数
             $s_against_value = 0;
             // 反对威望系数
             // 是否最佳回复
             if ($questions_info[$answers_val['question_id']]['best_answer'] == $answers_val['answer_id']) {
                 $s_best_answer = 1;
             } else {
                 $s_best_answer = 0;
             }
             // 赞同的用户
             if ($vote_agree_users[$answers_val['answer_id']]) {
                 foreach ($vote_agree_users[$answers_val['answer_id']] as $key => $val) {
                     // 排除发起者
                     if ($questions_info[$answers_val['question_id']]['published_uid'] != $val['answer_uid']) {
                         $s_agree_value = $s_agree_value + $val['reputation_factor'];
                         if ($questions_info[$answers_val['question_id']]['published_uid'] == $val['vote_uid'] and !$s_publisher_agree) {
                             $s_publisher_agree = 1;
                         }
                     }
                 }
             }
             // 反对的用户
             if ($vote_against_users[$answers_val['answer_id']]) {
                 foreach ($vote_against_users[$answers_val['answer_id']] as $key => $val) {
                     // 排除发起者
                     if ($questions_info[$answers_val['question_id']]['published_uid'] != $val['answer_uid']) {
                         $s_against_value = $s_against_value + $val['reputation_factor'];
                         if ($questions_info[$answers_val['question_id']]['published_uid'] == $val['vote_uid'] and !$s_publisher_against) {
                             $s_publisher_against = 1;
                         }
                     }
                 }
             }
             if ($s_publisher_agree) {
                 $s_agree_value = $s_agree_value - 1;
             }
             if ($s_publisher_against) {
                 $s_against_value = $s_against_value - 1;
             }
             $best_answer_reput = get_setting('best_answer_reput');
             // 最佳回复威望系数
             $publisher_reputation_factor = get_setting('publisher_reputation_factor');
             // 发起者赞同/反对威望系数
             $reputation_log_factor = get_setting('reputation_log_factor');
             //(用户组威望系数 x 赞同数量 - 用户组威望系数 x 反对数量)+ 发起者赞同反对系数 + 最佳答案系数
             $answer_reputation = $s_agree_value - $s_against_value + $s_publisher_agree * $publisher_reputation_factor - $s_publisher_against * $publisher_reputation_factor + $s_best_answer * $best_answer_reput;
             if ($answer_reputation < 0) {
                 $answer_reputation = 0 - $answer_reputation - 0.5;
                 if ($reputation_log_factor > 1) {
                     $answer_reputation = 0 - log($answer_reputation, $reputation_log_factor);
                 }
             } else {
                 if ($answer_reputation > 0) {
                     $answer_reputation = $answer_reputation + 0.5;
                     if ($reputation_log_factor > 1) {
                         $answer_reputation = log($answer_reputation, $reputation_log_factor);
                     }
                 }
             }
             // 计算在话题中的威望
             if ($answer_reputation) {
                 if ($question_topics[$answers_val['question_id']]) {
                     foreach ($question_topics[$answers_val['question_id']] as $key => $topic_info) {
                         $user_topics[$topic_info['topic_id']] = array('topic_id' => $topic_info['topic_id'], 'count' => intval($user_topics[$topic_info['topic_id']]['count']) + 1, 'agree_count' => intval($user_topics[$topic_info['topic_id']]['agree_count']) + $answers_val['agree_count'], 'thanks_count' => intval($user_topics[$topic_info['topic_id']]['thanks_count']) + $answers_val['thanks_count'], 'reputation' => $user_topics[$topic_info['topic_id']]['reputation'] + $answer_reputation);
                     }
                 }
             }
             if ($questions_info[$answers_val['question_id']]['category_id']) {
                 $user_reputation_category[$questions_info[$answers_val['question_id']]['category_id']]['reputation'] += $answer_reputation;
                 $user_reputation_category[$questions_info[$answers_val['question_id']]['category_id']]['agree_count'] += $answers_val['agree_count'];
                 $user_reputation_category[$questions_info[$answers_val['question_id']]['category_id']]['questions'][$answers_val['question_id']] = $answers_val['question_id'];
             }
             $user_reputation = $user_reputation + $answer_reputation;
         }
     }
     if (is_array($user_topics)) {
         if ($user_topics = aasort($user_topics, 'count', 'DESC')) {
             $user_topics = array_slice($user_topics, 0, 20);
         }
         foreach ($user_topics as $t_key => $t_val) {
             if ($reputation_topic_id = $this->fetch_one('reputation_topic', 'auto_id', 'uid = ' . $uid . ' AND topic_id = ' . $t_val['topic_id'])) {
                 $this->update('reputation_topic', array('uid' => $uid, 'topic_id' => $t_val['topic_id'], 'topic_count' => $t_val['count'], 'update_time' => time(), 'agree_count' => $t_val['agree_count'], 'thanks_count' => $t_val['thanks_count'], 'reputation' => round($t_val['reputation'])), 'auto_id = ' . $reputation_topic_id);
             } else {
                 $this->insert('reputation_topic', array('uid' => $uid, 'topic_id' => $t_val['topic_id'], 'topic_count' => $t_val['count'], 'update_time' => time(), 'agree_count' => $t_val['agree_count'], 'thanks_count' => $t_val['thanks_count'], 'reputation' => round($t_val['reputation'])));
             }
         }
     }
     if (is_array($user_reputation_category)) {
         foreach ($user_reputation_category as $t_key => $t_val) {
             if ($user_reputation_category_id = $this->fetch_one('reputation_category', 'auto_id', 'uid = ' . intval($uid) . ' AND category_id = ' . $t_key)) {
                 $this->update('reputation_category', array('uid' => intval($uid), 'category_id' => $t_key, 'update_time' => time(), 'reputation' => round($t_val['reputation']), 'agree_count' => $t_val['agree_count'], 'question_count' => count($t_val['questions'])), 'auto_id = ' . $user_reputation_category_id);
             } else {
                 $this->insert('reputation_category', array('uid' => intval($uid), 'category_id' => $t_key, 'update_time' => time(), 'reputation' => round($t_val['reputation']), 'agree_count' => $t_val['agree_count'], 'question_count' => count($t_val['questions'])));
             }
         }
     }
     $this->model('account')->update_users_fields(array('reputation' => round($user_reputation), 'reputation_update_time' => time()), $uid);
     $this->model('account')->update_user_reputation_group($uid);
 }
Exemplo n.º 10
0
"> [<?php 
            echo $abbr;
            ?>
 <?php 
            echo formatOffset($offset);
            ?>
] <?php 
            echo $tz;
            ?>
</option>-->
	   <?php 
        }
        ?>
	   
	   <?php 
        aasort($tzArray, "offset");
        foreach ($tzArray as $tz) {
            if ($tz["tz"] == $TimeZone) {
                $sel = 'selected="selected" style="background-color: yellow;"';
            } else {
                $sel = "";
            }
            ?>
<option <?php 
            echo $sel;
            ?>
 value="<?php 
            echo $tz["tz"];
            ?>
"> (<?php 
            echo formatOffset($tz["offset"]);
Exemplo n.º 11
0
function Dashboard($dashboard, $plan, $tag, $move)
{
    $offset = getOffset();
    setTimezone();
    $r = '-7' - $_GET['move'];
    $s = '-1' - $_GET['move'];
    $from = date("Y/m/d", strtotime($r . ' days'));
    $to = date("Y/m/d", strtotime($s . ' days'));
    $theDate = date('Y/m/d', strtotime($from . ' -1 days'));
    while ($theDate != $to) {
        $theDate = date('Y/m/d', strtotime($theDate . ' +1 days'));
        $category[] = $theDate;
    }
    $dashList = readDashboard($dashboard);
    $peakHour = str_replace(":", "", "18");
    $offPeakHour = str_replace(":", "", "22");
    foreach ($dashList as $dash) {
        $id_item = $dash['id_item'];
        $descriptionLong = $dash['descriptionLong'];
        $planList = readPlan();
        foreach ($planList as $plan) {
            unset($weekAvgPeak);
            unset($weekAvgOffPeak);
            unset($weekQoEPeak);
            unset($weekQoEOffPeak);
            $id_plan = $plan['id_plan'];
            $ldata = loadRAWData($from, $id_plan, $id_item);
            $unit = $ldata['unit'];
            $div = $ldata['div'];
            $plan = $ldata['plan'];
            $percentile = calculatePercentile($ldata['allData']);
            if (isset($ldata['hostList'])) {
                foreach ($ldata['hostList'] as $host) {
                    $id_host = $host['id_host'];
                    $nacD = $host['nacD'];
                    $nacU = $host['nacU'];
                    $critical = $host['critical'];
                    $warning = $host['warning'];
                    $nominal = $host['nominal'];
                    if ($warning > 100) {
                        $dir = 1;
                    } else {
                        $dir = 0;
                    }
                    if ($nominal == -1) {
                        $nominal = $nacD;
                    }
                    if ($nominal == -2) {
                        $nominal = $nacU;
                    }
                    if (isset($ldata['historyList'][$id_host])) {
                        foreach ($ldata['historyList'][$id_host] as $key => $row) {
                            $tk = date('m/d', $row['clock']);
                            if (!isset($weekAvgPeak[$tk])) {
                                $weekAvgPeak[$tk] = array($tk, 0, 0);
                            }
                            if (!isset($weekAvgOffPeak[$tk])) {
                                $weekAvgOffPeak[$tk] = array($tk, 0, 0);
                            }
                            if (!isset($weekQoEPeak[$tk])) {
                                $weekQoEPeak[$tk] = array($tk, 0, 0);
                            }
                            if (!isset($weekQoEOffPeak[$tk])) {
                                $weekQoEOffPeak[$tk] = array($tk, 0, 0);
                            }
                            $skip = false;
                            if (isset($_SESSION['filter']['P95']) && $row['value'] > $percentile['P95']) {
                                $skip = true;
                            }
                            if (isset($_SESSION['filter']['P5']) && $row['value'] < $percentile['P5']) {
                                $skip = true;
                            }
                            if (!$skip) {
                                if ($row['t'] == 'P') {
                                    $sum = $weekAvgPeak[$tk][1];
                                    $cnt = $weekAvgPeak[$tk][2];
                                    $x = $sum + $row['value'];
                                    $y = $cnt + 1;
                                    $weekAvgPeak[$tk] = array($tk, $x, $y);
                                }
                                if ($row['t'] == 'O') {
                                    $sum = $weekAvgOffPeak[$tk][1];
                                    $cnt = $weekAvgOffPeak[$tk][2];
                                    $x = $sum + $row['value'];
                                    $y = $cnt + 1;
                                    $weekAvgOffPeak[$tk] = array($tk, $x, $y);
                                }
                                if ($row['value'] > $nacD) {
                                    $row['value'] = $nominal;
                                }
                                if ($row['t'] == 'P') {
                                    $sum = $weekQoEPeak[$tk][1];
                                    $cnt = $weekQoEPeak[$tk][2];
                                    $x = $sum + $row['value'];
                                    $y = $cnt + 1;
                                    $weekQoEPeak[$tk] = array($tk, $x, $y);
                                }
                                if ($row['t'] == 'O') {
                                    $sum = $weekQoEOffPeak[$tk][1];
                                    $cnt = $weekQoEOffPeak[$tk][2];
                                    $x = $sum + $row['value'];
                                    $y = $cnt + 1;
                                    $weekQoEOffPeak[$tk] = array($tk, $x, $y);
                                }
                            }
                        }
                    }
                }
            }
            unset($dataPeak);
            unset($dataOffPeak);
            unset($dataQoEPeak);
            unset($dataQoEOffPeak);
            unset($dataNominal);
            unset($dataWarning);
            unset($dataCritical);
            if (isset($weekQoEPeak)) {
                aasort($weekQoEPeak, 0);
                aasort($weekQoEOffPeak, 0);
                aasort($weekAvgPeak, 0);
                aasort($weekAvgOffPeak, 0);
                $sumQoEPeak = 0;
                $cntQoEPeak = 0;
                $sumQoEOffPeak = 0;
                $cntQoEOffPeak = 0;
                foreach (array_reverse($weekQoEPeak) as $tvalue) {
                    $key = $tvalue[0];
                    $sumQoEPeak += $weekQoEPeak[$key][1];
                    $cntQoEPeak += $weekQoEPeak[$key][2];
                    $sumQoEOffPeak += $weekQoEOffPeak[$key][1];
                    $cntQoEOffPeak += $weekQoEOffPeak[$key][2];
                    if ($weekQoEPeak[$key][2] > 0) {
                        $dataQoEPeak[$key] = array('x' => $key, 'y' => round($weekQoEPeak[$key][1] / $weekQoEPeak[$key][2] / $div, 2), 'cnt' => $weekQoEPeak[$key][2]);
                    }
                    // ColorBar($x,$nominal,$warning,$critical,$value,$div)
                    if ($weekQoEOffPeak[$key][2] > 0) {
                        $dataQoEOffPeak[$key] = array('x' => $key, 'y' => round($weekQoEOffPeak[$key][1] / $weekQoEOffPeak[$key][2] / $div, 2), 'cnt' => $weekQoEOffPeak[$key][2]);
                    }
                    if ($weekAvgPeak[$key][2] > 0) {
                        $dataAvgPeak[$key] = array('x' => $key, 'y' => round($weekAvgPeak[$key][1] / $weekAvgPeak[$key][2] / $div, 2), 'cnt' => $weekAvgPeak[$key][2]);
                    }
                    if ($weekAvgOffPeak[$key][2] > 0) {
                        $dataAvgOffPeak[$key] = array('x' => $key, 'y' => round($weekAvgOffPeak[$key][1] / $weekAvgOffPeak[$key][2] / $div, 2), 'cnt' => $weekAvgOffPeak[$key][2]);
                    }
                }
                //echo  $items['descriptionLong'] . " " .  $plans['plan']  . " " . $host['host'] ;
                //var_dump($dataQoEPeak);
                //echo "<br>";
                if (!isset($dataAvgOffPeak)) {
                    $dataAvgOffPeak = null;
                }
                if (!isset($dataQoEPeak)) {
                    $dataQoEPeak = null;
                }
                if (!isset($dataAvgPeak)) {
                    $dataAvgPeak = null;
                }
                if ($cntQoEOffPeak == 0) {
                    $cntQoEOffPeak = 1.0E+22;
                }
                if ($cntQoEPeak == 0) {
                    $cntQoEPeak = 9.999999999999999E+22;
                }
                $dataList[] = array('descriptionLong' => $descriptionLong, 'plan' => $plan, 'id_plan' => $id_plan, 'id_item' => $id_item, 'QoEPeak' => $dataQoEPeak, 'QoEPeakAvg' => round($sumQoEPeak / $cntQoEPeak / $div, 2), 'QoEOffPeak' => $dataQoEOffPeak, 'QoEOffPeakAvg' => round($sumQoEOffPeak / $cntQoEOffPeak / $div, 2), 'AvgPeak' => $dataAvgPeak, 'AvgOffPeak' => $dataAvgOffPeak, 'nominal' => round($nominal / $div, 2), 'warning' => round($warning, 2), 'critical' => round($critical, 2), 'unit' => $unit, 'cntQoEPeak' => $cntQoEPeak, 'cntQoEOffPeak' => $cntQoEOffPeak, 'category' => $category);
            }
        }
    }
    echo '<table width="100%" border="0"><tr><td><center>';
    echo '<table class="tooltip-tabla">';
    $img1 = '<a href="./index.php?route=home0&dashboard=' . $dashboard . '&move=' . ($_GET['move'] + 1) . '"><span class="glyphicon glyphicon-backward"></span></a>';
    $img2 = '<a href="./index.php?route=home0&dashboard=' . $dashboard . '&move=' . ($_GET['move'] - 1) . '"><span class="glyphicon glyphicon-forward"></a>';
    $img3 = '<a href="./index.php?route=home0&dashboard=' . $dashboard . '&move=' . ($_GET['move'] + 7) . '"><span class="glyphicon glyphicon-fast-backward"></span></a>';
    $img4 = '<a href="./index.php?route=home0&dashboard=' . $dashboard . '&move=' . ($_GET['move'] - 7) . '"><span class="glyphicon glyphicon-fast-forward"></a>';
    echo '<tbody><tr><th>' . $img1 . "&nbsp;" . $img3 . '</th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th style="text-align: right;">' . $img4 . "&nbsp;" . $img2 . '</th></tr></tbody>';
    $t = '';
    if (isset($dataList)) {
        foreach ($dataList as $data) {
            $timeSlot = 'PEAK';
            for ($ij = 1; $ij <= 2; $ij++) {
                if ($timeSlot == 'PEAK') {
                    $QoE = 'QoEPeak';
                    $Avg = 'QoEPeakAvg';
                    $Cnt = 'cntQoEPeak';
                } else {
                    $QoE = 'QoEOffPeak';
                    $Avg = 'QoEOffPeakAvg';
                    $Cnt = 'cntQoEOffPeak';
                }
                if ($t != $data['descriptionLong']) {
                    $t = $data['descriptionLong'];
                    echo '<tbody><tr><th class="success" colspan="12"><center><big>' . $t . '</big></center></th></tr></tbody>';
                    echo '<tr>';
                    echo '<td>Plan</td>';
                    echo '<td align="center">Left</td>';
                    echo '<td align="center">Nominal</td>';
                    //echo '<td align="center">Warning</td>';
                    //echo '<td align="center">Critical</td>';
                    echo '<td>Week Average&nbsp;&nbsp;&nbsp;&nbsp;</td>';
                    for ($i = 0; $i < 7; $i++) {
                        if (date("w", strtotime($data['category'][$i])) == 0) {
                            $sun = '<font color="red">';
                        } else {
                            $sun = '<font color="black">';
                        }
                        echo '<td align="right">' . $sun . substr($data['category'][$i], 5) . '</font>&nbsp;&nbsp;&nbsp;&nbsp;</td>';
                    }
                    echo '</tr>';
                }
                $nominal = $data['nominal'];
                $warning = $data['warning'];
                $critical = $data['critical'];
                $unit = $data['unit'];
                echo '<tr>';
                echo '<td>' . $data['plan'] . '&nbsp;&nbsp;&nbsp;</td>';
                echo '<td>' . $timeSlot . '&nbsp;&nbsp;&nbsp;</td>';
                echo '<td align="right">&nbsp;' . number_format($nominal, 2) . ' ' . $unit . '&nbsp;</td>';
                //echo '<td align="right">&nbsp;' . number_format($nominal*$warning/100,2) . ' ' . $unit. '&nbsp;</td>';
                //echo '<td align="right">&nbsp;' . number_format($nominal*$critical/100,2) . ' ' . $unit. '&nbsp;</td>';
                echo '<td>';
                // . '&tag=' . $_GET['tag']
                echo '<a href="index.php?route=home0&type=bar&dashboard=' . $dashboard . '&move=' . $_GET['move'] . '&tag=' . $tag . '&idplan=' . $data['id_plan'] . '&from=' . $from . '&iditem=' . $data['id_item'] . '">';
                if (!isset($data[$Avg]) || $data[$Avg] == 0) {
                    echo '<center><img align="center" src="./images/Button-Close-icon.png" title="' . number_format($data[$Avg], 2) . ' ' . $unit . "<b>Q:" . '0' . '"></center>';
                } else {
                    if ($warning <= 100) {
                        $T1 = $nominal * $warning / 100;
                        $T2 = $nominal * $critical / 100;
                        if ($data[$Avg] >= $T1) {
                            $color = "./images/Green-Ball-icon.png";
                        } elseif ($data[$Avg] >= $T2 && $data[$Avg] < $T1) {
                            $color = "./images/Yellow-Ball-icon.png";
                        } else {
                            $color = "./images/Red-Ball-icon.png";
                        }
                    } else {
                        $T1 = $nominal * $warning / 100;
                        $T2 = $nominal * $critical / 100;
                        if ($data[$Avg] < $T1) {
                            $color = "./images/Green-Ball-icon.png";
                        } elseif ($data[$Avg] >= $T1 && $data[$Avg] < $T2) {
                            $color = "./images/Yellow-Ball-icon.png";
                        } else {
                            $color = "./images/Red-Ball-icon.png";
                        }
                    }
                    echo '<center><img align="center" src="' . $color . '" data-toggle="tooltip" title="(' . number_format($data[$Avg] / $nominal * 100, 2) . '%) ' . number_format($data[$Avg], 2) . ' ' . $unit . "  Q:" . $data[$Cnt] . '"></center>';
                }
                echo '</a>';
                echo '</span></td>';
                for ($i = 0; $i < 7; $i++) {
                    $ky = substr($data['category'][$i], 5);
                    echo '<td>';
                    //echo '(' . $data[$QoE][$ky]['y'] . ')' . '<br>';
                    if (!isset($data[$QoE][$ky]['y']) || $data[$QoE][$ky]['y'] == 0 || $data[$QoE][$ky]['y'] == null) {
                        echo '<center><img align="center" src="./images/Button-Close-icon.png" title="No data"></center>';
                    } else {
                        if ($warning <= 100) {
                            $T1 = $nominal * $warning / 100;
                            $T2 = $nominal * $critical / 100;
                            if ($data[$QoE][$ky]['y'] >= $T1) {
                                $color = "./images/Flag-green-icon.png";
                            } elseif ($data[$QoE][$ky]['y'] >= $T2 && $data[$QoE][$ky]['y'] < $T1) {
                                $color = "./images/Flag-yellow-icon.png";
                            } else {
                                $color = "./images/Flag-red-icon.png";
                            }
                        } else {
                            $T1 = $nominal * $warning / 100;
                            $T2 = $nominal * $critical / 100;
                            if ($data[$QoE][$ky]['y'] < $T1) {
                                $color = "./images/Flag-green-icon.png";
                            } elseif ($data[$QoE][$ky]['y'] >= $T1 && $data[$QoE][$ky]['y'] < $T2) {
                                $color = "./images/Flag-yellow-icon.png";
                            } else {
                                $color = "./images/Flag-red-icon.png";
                            }
                        }
                        echo '<center><img align="center" src="' . $color . '" data-toggle="tooltip" title="' . $data[$QoE][$ky]['x'] . ' ' . number_format($data[$QoE][$ky]['y'], 2) . ' ' . $unit . "  Q:" . $data[$QoE][$ky]['cnt'] . '"></center>';
                    }
                    echo '</span></td>';
                }
                echo '</tr>';
                if ($timeSlot == 'PEAK') {
                    $timeSlot = 'OFFPEAK';
                } else {
                    $timeSlot = 'PEAK';
                }
            }
        }
    }
    echo '</table>';
    echo '</center></td></tr></table>';
}
Exemplo n.º 12
0
function char_quest(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $world_db, $characters_db, $action_permission, $user_lvl, $user_name, $quest_datasite, $itemperpage;
    wowhead_tt();
    require_once 'core/char/char_security.php';
    //==========================$_GET and SECURE=================================
    $start = isset($_GET['start']) ? $sqlc->quote_smart($_GET['start']) : 0;
    if (is_numeric($start)) {
    } else {
        $start = 0;
    }
    $order_by = isset($_GET['order_by']) ? $sqlc->quote_smart($_GET['order_by']) : 1;
    if (is_numeric($order_by)) {
    } else {
        $order_by = 1;
    }
    $dir = isset($_GET['dir']) ? $sqlc->quote_smart($_GET['dir']) : 0;
    if (preg_match('/^[01]{1}$/', $dir)) {
    } else {
        $dir = 0;
    }
    $order_dir = $dir ? 'ASC' : 'DESC';
    $dir = $dir ? 0 : 1;
    //==========================$_GET and SECURE end=============================
    $result = $sqlc->query('SELECT account, name, race, class, level, gender
                            FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT `username`, `gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $owner_acc_id . ' ORDER BY `gmlevel` DESC LIMIT 1');
        $owner_name = $sqlr->result($result, 0, 'username');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        if (empty($owner_gmlvl)) {
            $owner_gmlvl = 0;
        }
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $output .= '
                    <center>
                        <div id="tab_content">
                            <h1>' . $lang_char['quests'] . '</h1>
                            <br />';
            require_once 'core/char/char_header.php';
            $output .= '            
                            <br /><br />
                            <table class="lined" style="width: 550px;">
                                <tr>
                                    <th width="10%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_id'] . '</a></th>
                                    <th width="7%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_level'] . '</a></th>
                                    <th width="78%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_title'] . '</a></th>
                                    <th width="5%"><img src="img/aff_qst.png" width="14" height="14" border="0" alt="" /></th>
                                </tr>';
            $result = $sqlc->query('SELECT quest, status FROM character_queststatus WHERE guid = ' . $id . ' AND ( status = 3 OR status = 1 ) ORDER BY status DESC');
            $quests_1 = array();
            $quests_3 = array();
            if ($sqlc->num_rows($result)) {
                while ($quest = $sqlc->fetch_assoc($result)) {
                    $deplang = get_lang_id();
                    $query1 = $sqlc->query('SELECT Level, IFNULL(' . ($deplang != 0 ? '`title_loc' . $deplang . '`' : 'NULL') . ', title) as Title FROM `' . $world_db[$realmid]['name'] . '`.`quest_template` LEFT JOIN `' . $world_db[$realmid]['name'] . '`.`locales_quest` ON `quest_template`.`id` = `locales_quest`.`entry` WHERE `quest_template`.`id` = \'' . $quest['quest'] . '\'');
                    $quest_info = $sqlc->fetch_assoc($query1);
                    if (1 == $quest['status']) {
                        array_push($quests_1, array($quest['quest'], $quest_info['QuestLevel'], $quest_info['Title'], $quest['rewarded']));
                    } else {
                        array_push($quests_3, array($quest['quest'], $quest_info['QuestLevel'], $quest_info['Title']));
                    }
                }
                unset($quest);
                unset($quest_info);
                aasort($quests_1, $order_by, $dir);
                $orderby = $order_by;
                if (2 < $orderby) {
                    $orderby = 1;
                }
                aasort($quests_3, $orderby, $dir);
                $all_record = count($quests_1);
                foreach ($quests_3 as $data) {
                    $output .= '
                                <tr>
                                    <td>' . $data[0] . '</td>
                                    <td>(' . $data[1] . ')</td>
                                    <td align="left"><a href="' . $quest_datasite . $data[0] . '" target="_blank">' . htmlentities($data[2]) . '</a></td>
                                    <td><img src="img/aff_qst.png" width="14" height="14" alt="" /></td>
                                </tr>';
                }
                unset($quest_3);
                if (count($quests_1)) {
                    $output .= '
                            </table>
                            <table class="hidden" style="width: 550px;">
                                <tr align="right">
                                    <td>';
                    $output .= generate_pagination('char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=' . $order_by . '&amp;dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
                    $output .= '
                                    </td>
                                </tr>
                            </table>
                            <table class="lined" style="width: 550px;">
                                <tr>
                                    <th width="10%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_id'] . '</a></th>
                                    <th width="7%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_level'] . '</a></th>
                                    <th width="68%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_title'] . '</a></th>
                                    <th width="10%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=3&amp;dir=' . $dir . '"' . ($order_by == 3 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['rewarded'] . '</a></th>
                                    <th width="5%"><img src="img/aff_tick.png" width="14" height="14" border="0" alt="" /></th>
                                </tr>';
                    $i = 0;
                    foreach ($quests_1 as $data) {
                        if ($i < $start + $itemperpage && $i >= $start) {
                            $output .= '
                                <tr>
                                    <td>' . $data[0] . '</td>
                                    <td>(' . $data[1] . ')</td>
                                    <td align="left"><a href="' . $quest_datasite . $data[0] . '" target="_blank">' . htmlentities($data[2]) . '</a></td>
                                    <td><img src="img/aff_' . ($data[3] ? 'tick' : 'qst') . '.png" width="14" height="14" alt="" /></td>
                                    <td><img src="img/aff_tick.png" width="14" height="14" alt="" /></td>
                                </tr>';
                        }
                        $i++;
                    }
                    unset($data);
                    unset($quest_1);
                    $output .= '
                                <tr align="right">
                                    <td colspan="5">';
                    $output .= generate_pagination('char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=' . $order_by . '&amp;dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
                    $output .= '
                                    </td>
                                </tr>';
                }
            } else {
                $output .= '
                                <tr>
                                    <td colspan="4"><p>' . $lang_char['no_act_quests'] . '</p></td>
                                </tr>';
            }
            //---------------Page Specific Data Ends here----------------------------
            //---------------Character Tabs Footer-----------------------------------
            $output .= '
                            </table>
                        </div>
                        </div>
                        <br />';
            require_once 'core/char/char_footer.php';
            $output .= '
                        <br />
                    </center>
                    <!-- end of char_quest.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Exemplo n.º 13
0
    }
    function aasort(&$array, $key)
    {
        $sorter = array();
        $ret = array();
        reset($array);
        foreach ($array as $ii => $va) {
            $sorter[$ii] = $va[$key];
        }
        asort($sorter);
        foreach ($sorter as $ii => $va) {
            $ret[$ii] = $array[$ii];
        }
        $array = $ret;
    }
    aasort($slbusesmetros, "departure");
    ?>
<table id="SLRealtime" data-refresh-every-n-seconds=30>
    <tr>
        <th style="width:3%"></th>
        <th style="width:75px;text-align:center"><img src="http://images2.wikia.nocookie.net/__cb20100824161519/logopedia/images/c/ca/SL_logo.svg" height="30px" /></th>
        <th style="padding-left:20"><?php 
    echo $slstation[0]->get('Name') . ' om ' . $distance . ' min';
    ?>
</th>
        <th style="width:12%;text-align:center">min.</th>
    </tr>
<?php 
    foreach ($slbusesmetros as $dps) {
        //if ($dps['transport'] == 'METRO'){
        //	$distance = 0;
 function result_sheet_ajax_rs()
 {
     $class_name_id = $_GET['class_name_id'];
     $class_id = $_GET['class_id'];
     $section_id = $_GET['section_id'];
     $exam_id = $_GET['exam_id'];
     $school_id = $_SESSION['school_id'];
     #$data['studentInfo'] = $this->Admin_model->result_sheet_ajax($_SESSION['school_id'],$class_name_id);
     $data['studentInfo'] = $this->Admin_model->result_sheet_ajax_rs($_SESSION['school_id'], $class_name_id, $section_id);
     $data['studentInfo'] = aasort($data['studentInfo'], 'roll_no');
     $list = $this->load->view('admin/result/ajax-student-result', $data, true);
     $result = 'success';
     $return = array('result' => $result, 'list' => $list);
     print json_encode($return);
     exit;
 }
Exemplo n.º 15
0
        }
    }
    if (!empty($request_params["max_price"])) {
        if ($csv_item_array[ITEM_PRICE] > $request_params["max_price"]) {
            continue;
        }
    }
    $result_array[] = array($csv_item_array[ITEM_ID], $csv_item_array[ITEM_TITLE], $csv_item_array[ITEM_DESCRIPTION], $csv_item_array[ITEM_PRICE]);
}
// SORT
switch ($request_params["sort"]) {
    case "price":
        aasort($result_array, ITEM_PRICE);
        break;
    case "id":
        aasort($result_array, ITEM_ID);
        break;
    default:
        break;
}
// PAGE && LIMIT
$offset = ($request_params["page"] - 1) * $request_params["limit"];
if ($offset < 0) {
    $offset = 0;
}
$length = $request_params["limit"] - $offset;
if ($length < $request_params["limit"]) {
    $length = $request_params["limit"];
}
$result_array = array_slice($result_array, $offset, $length);
// OUTPUT
Exemplo n.º 16
0
function GraphHour($chart, $id_chart, $id_plan, $id_item, $tag, $from, &$hgram, &$low, &$mid, &$max, &$dir)
{
    $offset = getOffset();
    setTimezone();
    $ldata = loadRAWData($from, $id_plan, $id_item);
    $unit = $ldata['unit'];
    $div = $ldata['div'];
    $percentile = calculatePercentile($ldata['allData']);
    $low = 0;
    $mid = 0;
    $max = 0;
    if (isset($ldata['hostList'])) {
        foreach ($ldata['hostList'] as $host) {
            $id_host = $host['id_host'];
            $nacD = $host['nacD'];
            $nacU = $host['nacU'];
            $critical = $host['critical'];
            $warning = $host['warning'];
            $nominal = $host['nominal'];
            if ($warning > 100) {
                $dir = 1;
            } else {
                $dir = 0;
            }
            if ($nominal == -1) {
                $nominal = $nacD;
            }
            if ($nominal == -2) {
                $nominal = $nacU;
            }
            if (isset($ldata['historyList'][$id_host])) {
                foreach ($ldata['historyList'][$id_host] as $key => $row) {
                    $tk = date('H', $row['clock']) * 1;
                    if (!isset($hourAvg[$tk])) {
                        $hourAvg[$tk] = array($tk, 0, 0);
                    }
                    if (!isset($hourQoE[$tk])) {
                        $hourQoE[$tk] = array($tk, 0, 0);
                    }
                    $skip = false;
                    if (isset($_SESSION['filter']['P95']) && $row['value'] > $percentile['P95']) {
                        $skip = true;
                    }
                    if (isset($_SESSION['filter']['P5']) && $row['value'] < $percentile['P5']) {
                        $skip = true;
                    }
                    if (!$skip) {
                        $filteredData[] = array(round($row['value'] / $div, 2));
                        if ($warning <= 100) {
                            if ($row['value'] >= $nominal * $warning / 100) {
                                $max++;
                            }
                            if ($row['value'] < $nominal * $warning / 100 && $row['value'] >= $nominal * $critical / 100) {
                                $mid++;
                            }
                            if ($row['value'] < $nominal * $critical / 100) {
                                $low++;
                            }
                        } else {
                            if ($row['value'] <= $nominal * $warning / 100) {
                                $max++;
                            }
                            if ($row['value'] > $nominal * $warning / 100 && $row['value'] <= $nominal * $critical / 100) {
                                $mid++;
                            }
                            if ($row['value'] > $nominal * $critical / 100) {
                                $low++;
                            }
                        }
                        $sum = $hourAvg[$tk][1];
                        $cnt = $hourAvg[$tk][2];
                        $x = $sum + $row['value'];
                        $y = $cnt + 1;
                        $hourAvg[$tk] = array($tk, $x, $y);
                        if ($row['value'] > $nacD) {
                            $row['value'] = $nacD;
                        }
                        $sum = $hourQoE[$tk][1];
                        $cnt = $hourQoE[$tk][2];
                        $x = $sum + $row['value'];
                        $y = $cnt + 1;
                        $hourQoE[$tk] = array($tk, $x, $y);
                    }
                }
            }
        }
    }
    $offset = 0;
    unset($dataQoE);
    unset($dataAvg);
    unset($data3);
    unset($data4);
    unset($data5);
    if (isset($hourQoE)) {
        aasort($hourQoE, 0);
        unset($k);
        for ($h = 0; $h < 24; $h++) {
            if (isset($hourQoE[$h])) {
                $dataQoE[] = ColorBar($h, $nominal, $warning, $critical, $hourQoE[$h][1] / $hourQoE[$h][2], $div);
                $data3[] = array('x' => $h, 'y' => round($nominal / $div, 2));
                $data4[] = array('x' => $h, 'y' => round($nominal / $div * $warning / 100, 2));
                $data5[] = array('x' => $h, 'y' => round($nominal / $div * $critical / 100, 2));
            } else {
                $dataQoE[] = null;
                $data3[] = array('x' => $h, 'y' => round($nominal / $div, 2));
                $data4[] = array('x' => $h, 'y' => round($nominal / $div * $warning / 100, 2));
                $data5[] = array('x' => $h, 'y' => round($nominal / $div * $critical / 100, 2));
            }
        }
        aasort($hourAvg, 0);
        for ($h = 0; $h < 24; $h++) {
            if (isset($hourQoE[$h])) {
                $dataAvg[] = array('x' => $h, 'y' => round($hourQoE[$h][1] / $hourQoE[$h][2] / $div, 2), 'color' => 'silver');
                $category[] = str_pad($h . ":00", 5, "0", STR_PAD_LEFT);
            } else {
                $dataAvg[] = null;
                $category[] = str_pad($h . ":00", 5, "0", STR_PAD_LEFT);
            }
        }
        for ($i = 0; $i < count($dataAvg); $i++) {
            $dataAvg[$i]['y'] = round($dataAvg[$i]['y'] - $dataQoE[$i]['y'], 2);
        }
    }
    if (!isset($filteredData)) {
        $filteredData = null;
        $nominal = 0;
        $category = null;
        $data3 = null;
        $data4 = null;
        $data5 = null;
        $warning = 0;
        $critical = 0;
        $dataAvg = null;
        $dataQoE = null;
    }
    $hgram = createHistogram($filteredData, 0, round($nominal / $div * 2, 0), round($nominal / $div / 6, 0) + 1, 0);
    $title = 'Average by Hour for "' . $ldata['item'] . '" on plan "' . $ldata['plan'] . '"';
    $subtitle = 'From ' . $ldata['from'] . ' to ' . $ldata['to'];
    $chart = chartHeader($chart, $id_chart, $title, $subtitle, $ldata['unit'], $category);
    $chart->plotOptions->series->pointPadding = -0.2;
    if ($ldata['peak'] > $ldata['offpeak']) {
        $chart->xAxis->plotBands = array(array('label' => array('text' => 'Peak Hour', 'x' => 2, 'style' => array('fontSize' => '8px', 'color' => 'red')), 'from' => $ldata['peak'] - 0.5, 'to' => 24 - 1.5, 'color' => '#FCFFC5'), array('label' => array('text' => 'Peak Hour', 'x' => 2, 'style' => array('fontSize' => '8px', 'color' => 'red')), 'from' => -0.5, 'to' => $ldata['offpeak'] + 1.5, 'color' => '#FCFFC5'));
    } else {
        $chart->xAxis->plotBands = array('label' => array('text' => 'Peak Hour', 'x' => 2, 'style' => array('fontSize' => '8px', 'color' => 'red')), 'from' => $ldata['peak'] - 0.5, 'to' => $ldata['offpeak'] + 0.5, 'color' => '#FCFFC5');
    }
    $chart->series[0]->type = 'column';
    $chart->title->style->fontSize = '14px';
    $chart->subtitle->style->fontSize = '10px';
    $chart->series[0]->data = $dataAvg;
    $chart->series[0]->stack = 0;
    $chart->series[0]->tooltip->valueSuffix = ' ' . $ldata['unit'];
    $chart->series[0]->name = 'Sample average for ' . $ldata['plan'];
    $chart->series[0]->dataLabels->enabled = true;
    $chart->series[0]->dataLabels->crop = true;
    $chart->series[0]->dataLabels->overflow = 'none';
    $chart->series[0]->dataLabels->align = 'center';
    $chart->series[0]->dataLabels->y = -8;
    $chart->series[0]->dataLabels->color = 'black';
    //'#000000';
    $chart->series[0]->dataLabels->style->fontSize = '10px';
    $chart->series[0]->dataLabels->style->fontFamily = 'Verdana, sans-serif';
    $chart->series[0]->dataLabels->formatter = new HighchartJsExpr("function() { return Highcharts.numberFormat(this.point.stackTotal, 2, '.');}");
    $chart->series[1]->type = 'column';
    $chart->series[1]->data = $dataQoE;
    $chart->series[1]->stack = 0;
    $chart->series[1]->tooltip->valueSuffix = ' ' . $ldata['unit'];
    $chart->series[1]->name = 'Real average for ' . $ldata['plan'];
    $chart->series[1]->dataLabels->enabled = true;
    $chart->series[1]->dataLabels->rotation = -90;
    $chart->series[1]->dataLabels->crop = false;
    $chart->series[1]->dataLabels->align = 'center';
    $chart->series[1]->dataLabels->color = '#FFFFFF';
    $chart->series[1]->dataLabels->style->fontSize = '13px';
    $chart->series[1]->dataLabels->style->fontFamily = 'Verdana, sans-serif';
    $chart->series[1]->dataLabels->formatter = new HighchartJsExpr("function() { return Highcharts.numberFormat(this.y, 2, '.');}");
    $chart->series[2]->type = 'spline';
    $chart->series[2]->data = $data3;
    $chart->series[2]->stack = 1;
    $chart->series[2]->tooltip->valueSuffix = ' ' . $ldata['unit'];
    $chart->series[2]->name = 'Nominal at 100%';
    $chart->series[2]->dataLabels->crop = false;
    $chart->series[2]->dataLabels->enabled = false;
    $chart->series[2]->dataLabels->rotation = -90;
    $chart->series[2]->dataLabels->align = 'right';
    $chart->series[2]->dataLabels->x = 4;
    $chart->series[2]->dataLabels->y = 10;
    $chart->series[2]->dataLabels->color = '#FFFFFF';
    $chart->series[2]->dataLabels->style->fontSize = '13px';
    $chart->series[2]->dataLabels->style->fontFamily = 'Verdana, sans-serif';
    $chart->series[2]->lineWidth = 2;
    $chart->series[2]->color = 'green';
    $chart->series[2]->marker->fillColor = 'green';
    $chart->series[2]->marker->radius = 2;
    $chart->series[2]->dataLabels->formatter = new HighchartJsExpr("function() { return Highcharts.numberFormat(this.y, 2, '.');}");
    $chart->series[3]->type = 'spline';
    $chart->series[3]->data = $data4;
    $chart->series[3]->stack = 2;
    $chart->series[3]->tooltip->valueSuffix = ' ' . $ldata['unit'];
    $chart->series[3]->dataLabels->crop = false;
    $chart->series[3]->name = 'Warning at ' . $warning . '% of the threashold';
    $chart->series[3]->dataLabels->enabled = false;
    $chart->series[3]->dataLabels->rotation = -90;
    $chart->series[3]->dataLabels->align = 'right';
    $chart->series[3]->dataLabels->x = 4;
    $chart->series[3]->dataLabels->y = 10;
    $chart->series[3]->dataLabels->color = '#FFFFFF';
    $chart->series[3]->dataLabels->style->fontSize = '10px';
    $chart->series[3]->dataLabels->style->fontFamily = 'Verdana, sans-serif';
    $chart->series[3]->lineWidth = 2;
    $chart->series[3]->color = '#F79E03';
    $chart->series[3]->marker->fillColor = '#F79E03';
    $chart->series[3]->marker->radius = 2;
    $chart->series[3]->dataLabels->formatter = new HighchartJsExpr("function() { return Highcharts.numberFormat(this.y, 2, '.');}");
    $chart->series[4]->type = 'line';
    $chart->series[4]->data = $data5;
    $chart->series[4]->stack = 3;
    $chart->series[4]->tooltip->valueSuffix = ' ' . $ldata['unit'];
    $chart->series[4]->dataLabels->crop = false;
    $chart->series[4]->name = 'Critical at ' . $critical . '% of the threashold';
    $chart->series[4]->dataLabels->enabled = false;
    $chart->series[4]->dataLabels->rotation = -90;
    $chart->series[4]->dataLabels->align = 'right';
    $chart->series[4]->dataLabels->x = 4;
    $chart->series[4]->dataLabels->y = 10;
    $chart->series[4]->dataLabels->color = '#FFFFFF';
    $chart->series[4]->dataLabels->style->fontSize = '10px';
    $chart->series[4]->dataLabels->style->fontFamily = 'Verdana, sans-serif';
    $chart->series[4]->lineWidth = 2;
    $chart->series[4]->marker->radius = 2;
    $chart->series[4]->color = 'red';
    $chart->series[4]->marker->fillColor = 'red';
    $chart->series[4]->dataLabels->formatter = new HighchartJsExpr("function() { return Highcharts.numberFormat(this.y, 2, '.');}");
    return $chart;
}
Exemplo n.º 17
0
 public function get_helpful_users_by_topic_ids($topic_ids, $limit = 10, $experience_limit = 1)
 {
     if (!is_array($topic_ids)) {
         return false;
     }
     array_walk_recursive($topic_ids, 'intval_string');
     if ($helpful_users = AWS_APP::cache()->get('helpful_users_' . md5(implode('_', $topic_ids) . '_' . $limit . '_' . $experience_limit))) {
         return $helpful_users;
     }
     foreach ($topic_ids as $topic_id) {
         if ($reputation_list = $this->fetch_all('reputation_topic', 'reputation > 0 AND topic_id = ' . intval($topic_id), 'reputation DESC', $limit)) {
             foreach ($reputation_list as $key => $val) {
                 $best_answer_uids[$val['uid']] = $val['uid'];
             }
         }
     }
     if (!$best_answer_uids) {
         return false;
     }
     foreach ($best_answer_uids as $best_answer_uid) {
         $rank_rate = $this->sum('reputation_topic', 'reputation', 'reputation > 0 AND topic_id IN(' . implode(',', $topic_ids) . ') AND uid = ' . intval($best_answer_uid));
         $best_answer_user_ranks[] = array('rate' => $rank_rate, 'uid' => $best_answer_uid);
     }
     $best_answer_user_ranks = aasort($best_answer_user_ranks, 'rate', 'DESC');
     if (sizeof($best_answer_user_ranks) > $limit) {
         $best_answer_user_ranks = array_slice($best_answer_user_ranks, 0, $limit);
     }
     unset($best_answer_uids);
     foreach ($best_answer_user_ranks as $user_rank) {
         $best_answer_uids[$user_rank['uid']] = $user_rank['uid'];
     }
     $users_info = $this->model('account')->get_user_info_by_uids($best_answer_uids, true);
     foreach ($best_answer_user_ranks as $user_rank) {
         $helpful_users[$user_rank['uid']]['user_info'] = $users_info[$user_rank['uid']];
         $experience = array();
         foreach ($topic_ids as $topic_id) {
             $topic_agree_count = $this->model('reputation')->calculate_agree_count($user_rank['uid'], array($topic_id));
             $experience[] = array('topic_id' => $topic_id, 'agree_count' => $topic_agree_count);
         }
         $experience = aasort($experience, 'agree_count', 'DESC');
         if (sizeof($experience) > $experience_limit) {
             $experience = array_slice($experience, 0, $experience_limit);
         }
         foreach ($experience as $key => $val) {
             $helpful_users[$user_rank['uid']]['experience'][] = array('topic_id' => $val['topic_id'], 'agree_count' => $val['agree_count']);
             $experience_topic_ids[$val['topic_id']] = $val['topic_id'];
         }
     }
     $experience_topics_info = $this->model('topic')->get_topics_by_ids($experience_topic_ids);
     if ($helpful_users) {
         foreach ($helpful_users as $key => $val) {
             if (is_array($helpful_users[$key]['experience'])) {
                 foreach ($helpful_users[$key]['experience'] as $exp_key => $exp_val) {
                     $helpful_users[$key]['experience'][$exp_key]['topic_info'] = $experience_topics_info[$exp_val['topic_id']];
                 }
             }
         }
     }
     AWS_APP::cache()->set('helpful_users_' . md5(implode('_', $topic_ids) . '_' . $limit . '_' . $experience_limit), $helpful_users, get_setting('cache_level_low'));
     return $helpful_users;
 }
Exemplo n.º 18
0
if ($recmethod == "hightolow") {
    function aasort(&$array, $key)
    {
        $sorter = array();
        $ret = array();
        reset($array);
        foreach ($array as $ii => $va) {
            $sorter[$ii] = $va[$key];
        }
        asort($sorter);
        foreach ($sorter as $ii => $va) {
            $ret[$ii] = $array[$ii];
        }
        $array = $ret;
    }
    aasort($allprods, '5');
    foreach (array_reverse($allprods) as $ctr) {
        //echo $ctr[6]." ---- ".$ctr[8]."<br>";
        if (in_array($ctr[7], $recbrands) or $tempbrands == "") {
            if ($ctr[5] <= $recmaxprice) {
                echo '<a class="modal-trigger">';
                echo '<div class="prodbox col s2">';
                echo '<div class="card large">';
                echo '<div class="card-image">';
                echo '<img class="responsive-img" src="' . $ctr[3] . '">';
                echo '<span class="card-title"></span>';
                echo '</div>';
                echo '<div class="card-content">';
                echo '<p>' . $ctr[2] . '</p><br>';
                echo '<p>Brand : ' . $ctr[7] . '</p>';
                echo '<p>Price : ' . '<strike>' . $ctr[4] . '</strike>' . $ctr[5] . '</p>';
Exemplo n.º 19
0
 if ($recmethod == "hightolow") {
     function aasort(&$array, $key)
     {
         $sorter = array();
         $ret = array();
         reset($array);
         foreach ($array as $ii => $va) {
             $sorter[$ii] = $va[$key];
         }
         asort($sorter);
         foreach ($sorter as $ii => $va) {
             $ret[$ii] = $array[$ii];
         }
         $array = $ret;
     }
     aasort($allprods, '6');
     foreach (array_reverse($allprods) as $ctr) {
         //echo $ctr[6]." ---- ".$ctr[8]."<br>";
         if (in_array($ctr[8], $filteredbrands) or $recbrands == "") {
             if ($ctr[6] <= $recmaxprice) {
                 echo '<a class="modal-trigger">';
                 echo '<div class="prodbox col s2">';
                 echo '<div class="card large">';
                 echo '<div class="card-image">';
                 echo '<img class="responsive-img" src="' . $ctr[4] . '">';
                 echo '<span class="card-title"></span>';
                 echo '</div>';
                 echo '<div class="card-content">';
                 echo '<p>' . $ctr[2] . '</p><br>';
                 echo '<p>Brand : ' . $ctr[8] . '</p>';
                 echo '<p>Price : ' . '<strike>' . $ctr[5] . '</strike>&nbsp;' . $ctr[6] . '</p>';
Exemplo n.º 20
0
function char_quest()
{
    global $output, $realm_id, $world_db, $logon_db, $characters_db, $action_permission, $locales_search_option, $site_encoding, $user_lvl, $user_name, $base_datasite, $quest_datasite, $itemperpage, $sql, $core;
    if (empty($_GET["id"])) {
        error(lang("global", "empty_fields"));
    }
    if (empty($_GET["realm"])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sql["logon"]->quote_smart($_GET["realm"]);
        if (is_numeric($realmid)) {
            $sql["char"]->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name'], $characters_db[$realmid]["encoding"]);
        } else {
            $realmid = $realm_id;
        }
    }
    $id = $sql["char"]->quote_smart($_GET["id"]);
    if (!is_numeric($id)) {
        $id = 0;
    }
    //==========================$_GET and SECURE=================================
    $start = isset($_GET["start"]) ? $sql["char"]->quote_smart($_GET["start"]) : 0;
    if (!is_numeric($start)) {
        $start = 0;
    }
    $order_by = isset($_GET["order_by"]) ? $sql["char"]->quote_smart($_GET["order_by"]) : 1;
    if (!is_numeric($order_by)) {
    } else {
        $order_by = 1;
    }
    $dir = isset($_GET["dir"]) ? $sql["char"]->quote_smart($_GET["dir"]) : 0;
    if (!preg_match('/^[01]{1}$/', $dir)) {
        $dir = 0;
    }
    $order_dir = $dir ? 'ASC' : 'DESC';
    $dir = $dir ? 0 : 1;
    //==========================$_GET and SECURE end=============================
    if ($core == 1) {
        $result = $sql["char"]->query("SELECT acct, name, race, class, level, gender\r\n      FROM characters WHERE guid='" . $id . "' LIMIT 1");
    } else {
        $result = $sql["char"]->query("SELECT account AS acct, name, race, class, level, gender\r\n      FROM characters WHERE guid='" . $id . "' LIMIT 1");
    }
    if ($sql["char"]->num_rows($result)) {
        $char = $sql["char"]->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sql["char"]->result($result, 0, 'acct');
        if ($core == 1) {
            $result = $sql["logon"]->query("SELECT login FROM accounts WHERE acct='" . $char["acct"] . "'");
        } else {
            $result = $sql["logon"]->query("SELECT username AS login FROM account WHERE id='" . $char["acct"] . "'");
        }
        $owner_name = $sql["logon"]->result($result, 0, 'login');
        $s_query = "SELECT *, SecurityLevel AS gm FROM config_accounts WHERE Login='******'";
        $s_result = $sql["mgr"]->query($s_query);
        $s_fields = $sql["mgr"]->fetch_assoc($s_result);
        $owner_gmlvl = $s_fields["gm"];
        $view_mod = $s_fields["View_Mod_Quest"];
        if ($owner_gmlvl >= 1073741824) {
            $owner_gmlvl -= 1073741824;
        }
        // owner configured overrides
        $view_override = false;
        if ($view_mod > 0) {
            if ($view_mod == 1) {
            } elseif ($view_mod == 2) {
                // only registered users may view this page
                if ($user_lvl > -1) {
                    $view_override = true;
                }
            }
        }
        // visibility overrides for specific tabs
        $view_inv_override = false;
        if ($s_fields["View_Mod_Inv"] > 0) {
            if ($s_fields["View_Mod_Inv"] == 1) {
            } elseif ($s_fields["View_Mod_Inv"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_inv_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_inv_override = true;
            }
        }
        $view_talent_override = false;
        if ($s_fields["View_Mod_Talent"] > 0) {
            if ($s_fields["View_Mod_Talent"] == 1) {
            } elseif ($s_fields["View_Mod_Talent"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_talent_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_talent_override = true;
            }
        }
        $view_achieve_override = false;
        if ($s_fields["View_Mod_Achieve"] > 0) {
            if ($s_fields["View_Mod_Achieve"] == 1) {
            } elseif ($s_fields["View_Mod_Achieve"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_achieve_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_achieve_override = true;
            }
        }
        $view_friends_override = false;
        if ($s_fields["View_Mod_Friends"] > 0) {
            if ($s_fields["View_Mod_Friends"] == 1) {
            } elseif ($s_fields["View_Mod_Friends"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_friends_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_friends_override = true;
            }
        }
        $view_view_override = false;
        if ($s_fields["View_Mod_View"] > 0) {
            if ($s_fields["View_Mod_View"] == 1) {
            } elseif ($s_fields["View_Mod_View"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_view_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_view_override = true;
            }
        }
        if ($view_override || $user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
            $output .= '
            <div class="tab">
              <ul>
                <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "char_sheet") . '</a></li>';
            if ($view_inv_override) {
                $output .= '
                <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "inventory") . '</a></li>';
            }
            if ($view_talent_override) {
                $output .= '
                ' . ($char["level"] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "talents") . '</a></li>') . '';
            }
            if ($view_achieve_override) {
                $output .= '
                <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "achievements") . '</a></li>';
            }
            $output .= '
                <li class="selected"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "quests") . '</a></li>';
            if ($view_friends_override) {
                $output .= '
                <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "friends") . '</a></li>';
            }
            if ($view_view_override) {
                $output .= '
                <li><a href="char_view.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "view") . '</a></li>';
            }
            $output .= '
              </ul>
            </div>
            <div class="tab_content center center_text">
              <span class="bold">
                ' . htmlentities($char["name"], ENT_COMPAT, $site_encoding) . ' -
                <img src="img/c_icons/' . $char["race"] . '-' . $char["gender"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_race_name($char["race"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" />
                <img src="img/c_icons/' . $char["class"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_class_name($char["class"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" /> - ' . lang("char", "level_short") . char_get_level_color($char["level"]) . '
              </span>
              <br />
              <br />
              <table class="lined" id="ch_que_questsA">
                <tr>
                  <th style="width: 10%;"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "quest_id") . '</a></th>
                  <th style="width: 7%;"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "quest_level") . '</a></th>
                  <th style="width: 78%;"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "quest_title") . '</a></th>
                  <th style="width: 5%;"><img src="img/aff_qst.png" width="14" height="14" alt="" /></th>
                </tr>';
            if ($core == 1) {
                $result = $sql["char"]->query("SELECT quest_id, completed\r\n                                       FROM questlog\r\n                                       WHERE player_guid='" . $id . "'");
            } elseif ($core == 2) {
                $result = $sql["char"]->query("SELECT quest AS quest_id, status AS completed\r\n                                      FROM character_queststatus\r\n                                      WHERE guid='" . $id . "' AND rewarded=0 AND status<>0");
            } else {
                $result = $sql["char"]->query("SELECT quest AS quest_id, status AS completed\r\n                                      FROM character_queststatus\r\n                                      WHERE guid='" . $id . "' AND status<>0");
            }
            $quests_1 = array();
            $quests_3 = array();
            if ($sql["char"]->num_rows($result)) {
                while ($quest = $sql["char"]->fetch_assoc($result)) {
                    $deplang = get_lang_id();
                    if ($core == 1) {
                        $query1 = $sql["char"]->query("SELECT *, questlevel, Title AS Title1 FROM `" . $world_db[$realmid]['name'] . "`.quests " . ($locales_search_option != 0 ? "LEFT JOIN `" . $world_db[$realmid]['name'] . "`.quests_localized ON (quests_localized.entry=quests.entry AND language_code='" . $locales_search_option . "' ) " : " ") . "WHERE quests.entry='" . $quest["quest_id"] . "'");
                    } elseif ($core == 2) {
                        $query1 = $sql["char"]->query("SELECT *, QuestLevel AS questlevel, Title AS Title1 FROM `" . $world_db[$realmid]['name'] . "`.quest_template " . ($locales_search_option != 0 ? "LEFT JOIN `" . $world_db[$realmid]['name'] . "`.locales_quest ON locales_quest.entry=quest_template.entry " : " ") . "WHERE quest_template.entry='" . $quest["quest_id"] . "'");
                    } else {
                        $query1 = $sql["char"]->query("SELECT *, Level AS questlevel, Title AS Title1 FROM `" . $world_db[$realmid]['name'] . "`.quest_template " . ($locales_search_option != 0 ? "LEFT JOIN `" . $world_db[$realmid]['name'] . "`.locales_quest ON locales_quest.entry=quest_template.Id " : " ") . "WHERE quest_template.Id='" . $quest["quest_id"] . "'");
                    }
                    $quest_info = $sql["char"]->fetch_assoc($query1);
                    // Localization
                    if ($locales_search_option == 0) {
                        $quest_info["title"] = $quest_info["Title1"];
                    } else {
                        if ($core == 1) {
                            $quest_info["title"] = $quest_info["Title"];
                        } else {
                            $quest_info["title"] = $quest_info["Title_loc" . $locales_search_option];
                        }
                    }
                    if ($quest["completed"] == 1) {
                        array_push($quests_1, array($quest["quest_id"], $quest_info["questlevel"], $quest_info["title"], $quest["rewarded"]));
                    } else {
                        array_push($quests_3, array($quest["quest_id"], $quest_info["questlevel"], $quest_info["title"]));
                    }
                }
                unset($quest);
                unset($quest_info);
                aasort($quests_1, $order_by, $dir);
                $orderby = $order_by;
                if ($orderby > 2) {
                    $orderby = 1;
                }
                aasort($quests_3, $orderby, $dir);
                $all_record = count($quests_1);
                foreach ($quests_3 as $data) {
                    $output .= '
                <tr>
                  <td>' . $data[0] . '</td>
                  <td>(' . $data[1] . ')</td>
                  <td align="left"><a href="' . $base_datasite . $quest_datasite . $data[0] . '" rel="external">' . htmlentities($data[2], ENT_COMPAT, $site_encoding) . '</a></td>
                  <td><img src="img/aff_qst.png" width="14" height="14" alt="" /></td>
                </tr>';
                }
                unset($quest_3);
                if (count($quests_1)) {
                    $output .= '
              </table>
              <table class="hidden" id="ch_que_questsB">
                <tr align="right">
                  <td>';
                    $output .= generate_pagination('char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=' . $order_by . '&amp;dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
                    $output .= '
                  </td>
                </tr>
              </table>
              <table class="lined" id="ch_que_questsC">
                <tr>
                  <th style="width: 10%;"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "quest_id") . '</a></th>
                  <th style="width: 7%;"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "quest_level") . '</a></th>
                  <th style="width: 68%;"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "quest_title") . '</a></th>
                  <th style="width: 10%;"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=3&amp;dir=' . $dir . '"' . ($order_by == 3 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "rewarded") . '</a></th>
                  <th style="width: 5%;"><img src="img/aff_tick.png" width="14" height="14" alt="" /></th>
                </tr>';
                    $i = 0;
                    foreach ($quests_1 as $data) {
                        if ($i < $start + $itemperpage && $i >= $start) {
                            $output .= '
                <tr>
                  <td>' . $data[0] . '</td>
                  <td>(' . $data[1] . ')</td>
                  <td align="left"><a href="' . $base_datasite . $quest_datasite . $data[0] . '" rel="external">' . htmlentities($data[2], ENT_COMPAT, $site_encoding) . '</a></td>
                  <td><img src="img/aff_' . ($data[3] ? 'tick' : 'qst') . '.png" width="14" height="14" alt="" /></td>
                  <td><img src="img/aff_tick.png" width="14" height="14" alt="" /></td>
                </tr>';
                        }
                        $i++;
                    }
                    unset($data);
                    unset($quest_1);
                    $output .= '
                <tr align="right">
                  <td colspan="5">';
                    $output .= generate_pagination('char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=' . $order_by . '&amp;dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
                    $output .= '
                  </td>
                </tr>';
                }
            } else {
                $output .= '
                <tr>
                  <td colspan="4"><p>' . lang("char", "no_act_quests") . '</p></td>
                </tr>';
            }
            //---------------Page Specific Data Ends here----------------------------
            //---------------Character Tabs Footer-----------------------------------
            $output .= '
              </table>
            </div>
            <br />
            <table class="hidden center">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton(lang("char", "chars_acc"), 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"]) {
                //makebutton($lang_char["edit_button"], 'char_edit.php?id='.$id.'&amp;realm='.$realmid.'', 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"] || $owner_name === $user_name) {
                makebutton(lang("char", "del_char"), 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission["update"]) {
                makebutton(lang("char", "send_mail"), 'mail.php?type=ingame_mail&amp;to=' . $char["name"] . '', 130);
                $output .= '
                </td>
                <td>';
            }
            makebutton(lang("global", "back"), 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          <!-- end of char_quest.php -->';
        } else {
            error(lang("char", "no_permission"));
        }
    } else {
        error(lang("char", "no_char_found"));
    }
}
Exemplo n.º 21
0
function char_skill()
{
    global $output, $realm_id, $characters_db, $corem_db, $action_permission, $user_lvl, $site_encoding, $user_name, $base_datasite, $skill_datasite, $sql, $core;
    //wowhead_tt();
    if (empty($_GET["id"])) {
        error(lang("global", "empty_fields"));
    }
    // this is multi realm support, as of writing still under development
    //  this page is already implementing it
    if (empty($_GET["realm"])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sql["logon"]->quote_smart($_GET["realm"]);
        if (is_numeric($realmid)) {
            $sql["char"]->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name'], $characters_db[$realmid]["encoding"]);
        } else {
            $realmid = $realm_id;
        }
    }
    $id = $sql["char"]->quote_smart($_GET["id"]);
    if (!is_numeric($id)) {
        $id = 0;
    }
    $order_by = isset($_GET["order_by"]) ? $sql["char"]->quote_smart($_GET["order_by"]) : 1;
    $dir = isset($_GET["dir"]) ? $sql["char"]->quote_smart($_GET["dir"]) : 1;
    if (!preg_match('/^[01]{1}$/', $dir)) {
        $dir = 1;
    }
    $order_dir = $dir ? 'ASC' : 'DESC';
    $dir = $dir ? 0 : 1;
    if ($core == 1) {
        $result = $sql["char"]->query('SELECT acct, name, race, class, level, gender FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    } else {
        $result = $sql["char"]->query('SELECT account AS acct, name, race, class, level, gender FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    }
    if ($sql["char"]->num_rows($result)) {
        $char = $sql["char"]->fetch_assoc($result);
        // we get user permissions first
        $owner_acc_id = $sql["char"]->result($result, 0, 'acct');
        if ($core == 1) {
            $result = $sql["logon"]->query("SELECT login FROM accounts WHERE acct='" . $char["acct"] . "'");
        } else {
            $result = $sql["logon"]->query("SELECT username AS login FROM account WHERE id='" . $char["acct"] . "'");
        }
        $owner_name = $sql["logon"]->result($result, 0, 'login');
        $s_query = "SELECT *, SecurityLevel AS gm FROM config_accounts WHERE Login='******'";
        $s_result = $sql["mgr"]->query($s_query);
        $s_fields = $sql["mgr"]->fetch_assoc($s_result);
        $owner_gmlvl = $s_fields["gm"];
        $view_mod = $s_fields["View_Mod_Skill"];
        if ($owner_gmlvl >= 1073741824) {
            $owner_gmlvl -= 1073741824;
        }
        // owner configured overrides
        $view_override = false;
        if ($view_mod > 0) {
            if ($view_mod == 1) {
            } elseif ($view_mod == 2) {
                // only registered users may view this page
                if ($user_lvl > -1) {
                    $view_override = true;
                }
            }
        }
        // visibility overrides for specific tabs
        $view_inv_override = false;
        if ($s_fields["View_Mod_Inv"] > 0) {
            if ($s_fields["View_Mod_Inv"] == 1) {
            } elseif ($s_fields["View_Mod_Inv"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_inv_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_inv_override = true;
            }
        }
        $view_talent_override = false;
        if ($s_fields["View_Mod_Talent"] > 0) {
            if ($s_fields["View_Mod_Talent"] == 1) {
            } elseif ($s_fields["View_Mod_Talent"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_talent_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_talent_override = true;
            }
        }
        $view_achieve_override = false;
        if ($s_fields["View_Mod_Achieve"] > 0) {
            if ($s_fields["View_Mod_Achieve"] == 1) {
            } elseif ($s_fields["View_Mod_Achieve"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_achieve_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_achieve_override = true;
            }
        }
        $view_quest_override = false;
        if ($s_fields["View_Mod_Quest"] > 0) {
            if ($s_fields["View_Mod_Quest"] == 1) {
            } elseif ($s_fields["View_Mod_Quest"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_quest_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_quest_override = true;
            }
        }
        $view_friends_override = false;
        if ($s_fields["View_Mod_Friends"] > 0) {
            if ($s_fields["View_Mod_Friends"] == 1) {
            } elseif ($s_fields["View_Mod_Friends"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_friends_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_friends_override = true;
            }
        }
        $view_view_override = false;
        if ($s_fields["View_Mod_View"] > 0) {
            if ($s_fields["View_Mod_View"] == 1) {
            } elseif ($s_fields["View_Mod_View"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_view_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_view_override = true;
            }
        }
        $view_pets_override = false;
        if ($s_fields["View_Mod_Pets"] > 0) {
            if ($s_fields["View_Mod_Pets"] == 1) {
            } elseif ($s_fields["View_Mod_Pets"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_pets_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_pets_override = true;
            }
        }
        $view_rep_override = false;
        if ($s_fields["View_Mod_Rep"] > 0) {
            if ($s_fields["View_Mod_Rep"] == 1) {
            } elseif ($s_fields["View_Mod_Rep"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_rep_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_rep_override = true;
            }
        }
        $view_pvp_override = false;
        if ($s_fields["View_Mod_PvP"] > 0) {
            if ($s_fields["View_Mod_PvP"] == 1) {
            } elseif ($s_fields["View_Mod_PvP"] == 2) {
                // only registered users may view this tab
                if ($user_lvl > -1) {
                    $view_pvp_override = true;
                }
            }
        } else {
            if ($user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
                $view_pvp_override = true;
            }
        }
        if ($view_override || $user_lvl > $owner_gmlvl || $owner_name === $user_name || $user_lvl == $action_permission["delete"]) {
            if ($core == 1) {
                $result = $sql["char"]->query("SELECT data, name, race, class, level, gender FROM characters WHERE guid = '" . $id . "'");
                $char = $sql["char"]->fetch_assoc($result);
                $char_data = explode(';', $char["data"]);
            } else {
                $result = $sql["char"]->query("SELECT name, race, class, level, gender FROM characters WHERE guid='" . $id . "'");
                $char = $sql["char"]->fetch_assoc($result);
                $result = $sql["char"]->query("SELECT * FROM character_skills WHERE guid='" . $id . "'");
                // make TC's skill data work like our treatment of Arc's
                $char_data = array();
                $i = 0;
                while ($skill_row = $sql["char"]->fetch_assoc($result)) {
                    $char_data[PLAYER_SKILL_INFO_1_1 + $i] = $skill_row["skill"];
                    $char_data[PLAYER_SKILL_INFO_1_1 + $i + 1] = $skill_row["value"];
                    $char_data[PLAYER_SKILL_INFO_1_1 + $i + 2] = $skill_row["max"];
                    $i += 3;
                }
            }
            $output .= '
            <div class="tab">
              <ul>
                <li class="selected"><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "char_sheet") . '</a></li>';
            if ($view_inv_override) {
                $output .= '
                <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "inventory") . '</a></li>';
            }
            if ($view_talent_override) {
                $output .= '
                ' . ($char["level"] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "talents") . '</a></li>') . '';
            }
            if ($view_achieve_override) {
                $output .= '
                <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "achievements") . '</a></li>';
            }
            if ($view_quest_override) {
                $output .= '
                <li><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "quests") . '</a></li>';
            }
            if ($view_friends_override) {
                $output .= '
                <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "friends") . '</a></li>';
            }
            if ($view_view_override) {
                $output .= '
                <li><a href="char_view.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "view") . '</a></li>';
            }
            $output .= '
              </ul>
            </div>
            <div class="tab_content center">
              <div class="tab">
                <ul>
                  <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "char_sheet") . '</a></li>';
            if (char_get_class_name($char["class"]) == "Hunter" && $view_pets_override) {
                $output .= '
                  <li><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "pets") . '</a></li>';
            }
            if ($view_rep_override) {
                $output .= '
                  <li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "reputation") . '</a></li>';
            }
            $output .= '
                  <li class="selected"><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "skills") . '</a></li>';
            if ($view_pvp_override) {
                $output .= '
                  <li><a href="char_pvp.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "pvp") . '</a></li>';
            }
            if ($owner_name == $user_name || $user_lvl >= get_page_permission("insert", "char_mail.php")) {
                $output .= '
                  <li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . lang("char", "mail") . '</a></li>';
            }
            $output .= '
                </ul>
              </div>
              <div class="tab_content2 center center_text">
                <span class="bold">
                  ' . htmlentities($char["name"], ENT_COMPAT, $site_encoding) . ' -
                  <img src="img/c_icons/' . $char["race"] . '-' . $char["gender"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_race_name($char["race"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" />
                  <img src="img/c_icons/' . $char["class"] . '.gif" onmousemove="oldtoolTip(\'' . char_get_class_name($char["class"]) . '\', \'old_item_tooltip\')" onmouseout="oldtoolTip()" alt="" /> - ' . lang("char", "level_short") . char_get_level_color($char["level"]) . '
                </span>
                <br />
                <br />
                <table class="lined" id="ch_ski_main">
                  <tr>
                    <th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . lang("char", "skills") . '</th>
                  </tr>
                  <tr>
                    ' . ($user_lvl ? '<th><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "skill_id") . '</a></th>' : '') . '
                    <th align="right"><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "skill_name") . '</a></th>
                    <th><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . lang("char", "skill_value") . '</a></th>
                  </tr>';
            $skill_array = array();
            $class_array = array();
            $prof_1_array = array();
            $prof_2_array = array();
            $weapon_array = array();
            $armor_array = array();
            $language_array = array();
            $skill_rank_array = array(75 => lang("char", "apprentice"), 150 => lang("char", "journeyman"), 225 => lang("char", "expert"), 300 => lang("char", "artisan"), 375 => lang("char", "master"), 450 => lang("char", "inherent"), 385 => lang("char", "wise"));
            for ($i = PLAYER_SKILL_INFO_1_1; $i <= PLAYER_SKILL_INFO_1_1 + 384; $i += 3) {
                if ($char_data[$i] && skill_get_name($char_data[$i] & 0xffff)) {
                    $temp = unpack("S", pack("L", $char_data[$i + 1]));
                    $skill = $char_data[$i] & 0xffff;
                    if (skill_get_type($skill) == 6) {
                        array_push($weapon_array, array($user_lvl ? $skill : '', skill_get_name($skill), $temp[1]));
                    } elseif (skill_get_type($skill) == 7) {
                        array_push($class_array, array($user_lvl ? $skill : '', skill_get_name($skill), $temp[1]));
                    } elseif (skill_get_type($skill) == 8) {
                        array_push($armor_array, array($user_lvl ? $skill : '', skill_get_name($skill), $temp[1]));
                    } elseif (skill_get_type($skill) == 9) {
                        array_push($prof_2_array, array($user_lvl ? $skill : '', skill_get_name($skill), $temp[1]));
                    } elseif (skill_get_type($skill) == 10) {
                        array_push($language_array, array($user_lvl ? $skill : '', skill_get_name($skill), $temp[1]));
                    } elseif (skill_get_type($skill) == 11) {
                        array_push($prof_1_array, array($user_lvl ? $skill : '', skill_get_name($skill), $temp[1]));
                    } else {
                        array_push($skill_array, array($user_lvl ? $skill : '', skill_get_name($skill), $temp[1]));
                    }
                }
            }
            unset($char_data);
            aasort($skill_array, $order_by, $dir);
            aasort($class_array, $order_by, $dir);
            aasort($prof_1_array, $order_by, $dir);
            aasort($prof_2_array, $order_by, $dir);
            aasort($weapon_array, $order_by, $dir);
            aasort($armor_array, $order_by, $dir);
            aasort($language_array, $order_by, $dir);
            foreach ($skill_array as $data) {
                // this_is_junk: style left hardcoded because it's calculated.
                $max = $data[2] < $char["level"] * 5 ? $char["level"] * 5 : $data[2];
                $output .= '
                  <tr>
                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                    <td align="right">' . $data[1] . '</td>
                    <td class="bar skill_bar" style="background-position: ' . (round(385 * $data[2] / $max) - 385) . 'px;">
                      <span style="position: relative; top: -2px;">' . $data[2] . '/' . $max . '</span>
                    </td>
                  </tr>';
            }
            if (count($class_array)) {
                $output .= '
                  <tr><th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . lang("char", "classskills") . '</th></tr>';
            }
            foreach ($class_array as $data) {
                $max = $data[2] < $char["level"] * 5 ? $char["level"] * 5 : $data[2];
                $output .= '
                  <tr>
                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                    <td align="right"><a href="' . $base_datasite . $skill_datasite . '7.' . $char["class"] . '.' . $data[0] . '" rel="external">' . $data[1] . '</a></td>
                    <td class="bar skill_bar" style="background-position: 0px;">
                    </td>
                  </tr>';
            }
            if (count($prof_1_array)) {
                $output .= '
                  <tr><th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . lang("char", "professions") . '</th></tr>';
            }
            foreach ($prof_1_array as $data) {
                // this_is_junk: style left hardcoded because it's calculated.
                $max = $data[2] < 76 ? 75 : ($data[2] < 151 ? 150 : ($data[2] < 226 ? 225 : ($data[2] < 301 ? 300 : ($data[2] < 376 ? 375 : ($data[2] < 376 ? 375 : 450)))));
                $output .= '
                  <tr>
                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                    <td align="right"><a href="' . $base_datasite . $skill_datasite . '11.' . $data[0] . '" rel="external">' . $data[1] . '</a></td>
                    <td class="bar skill_bar" style="background-position: ' . (round(385 * $data[2] / $max) - 385) . 'px;">
                      <span style="position: relative; top: -2px;">' . $data[2] . '/' . $max . ' (' . $skill_rank_array[$max] . ')</span>
                    </td>
                  </tr>';
            }
            if (count($prof_2_array)) {
                $output .= '
                  <tr><th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . lang("char", "secondaryskills") . '</th></tr>';
            }
            foreach ($prof_2_array as $data) {
                // this_is_junk: style left hardcoded because it's calculated.
                $max = $data[2] < 76 ? 75 : ($data[2] < 151 ? 150 : ($data[2] < 226 ? 225 : ($data[2] < 301 ? 300 : ($data[2] < 376 ? 375 : ($data[2] < 376 ? 375 : 450)))));
                $output .= '
                  <tr>
                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                    <td align="right"><a href="' . $base_datasite . $skill_datasite . '9.' . $data[0] . '" rel="external">' . $data[1] . '</a></td>
                    <td class="bar skill_bar" style="background-position: ' . (round(385 * $data[2] / $max) - 385) . 'px;">
                      <span style="position: relative; top: -2px;">' . $data[2] . '/' . $max . ' (' . $skill_rank_array[$max] . ')</span>
                    </td>
                  </tr>';
            }
            if (count($weapon_array)) {
                $output .= '
                  <tr><th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . lang("char", "weaponskills") . '</th></tr>';
            }
            foreach ($weapon_array as $data) {
                // this_is_junk: style left hardcoded because it's calculated.
                $max = $data[2] < $char["level"] * 5 ? $char["level"] * 5 : $data[2];
                $output .= '
                  <tr>
                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                    <td align="right">' . $data[1] . '</td>
                    <td class="bar skill_bar" style="background-position: ' . (round(385 * $data[2] / $max) - 385) . 'px;">
                      <span style="position: relative; top: -2px;">' . $data[2] . '/' . $max . '</span>
                    </td>
                  </tr>';
            }
            if (count($armor_array)) {
                $output .= '
                  <tr><th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . lang("char", "armorproficiencies") . '</th></tr>';
            }
            foreach ($armor_array as $data) {
                $max = $data[2] < $char["level"] * 5 ? $char["level"] * 5 : $data[2];
                $output .= '
                  <tr>
                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                    <td align="right">' . $data[1] . '</td>
                    <td class="bar skill_bar" style="background-position: 0px;">
                    </td>
                  </tr>';
            }
            if (count($language_array)) {
                $output .= '
                  <tr><th class="title" colspan="' . ($user_lvl ? '3' : '2') . '" align="left">' . lang("char", "languages") . '</th></tr>';
            }
            foreach ($language_array as $data) {
                // this_is_junk: style left hardcoded because it's calculated.
                $max = $data[2] < $char["level"] * 5 ? $char["level"] * 5 : $data[2];
                $output .= '
                  <tr>
                    ' . ($user_lvl ? '<td>' . $data[0] . '</td>' : '') . '
                    <td align="right">' . $data[1] . '</td>
                    <td class="bar skill_bar" style="background-position: ' . (round(385 * $data[2] / $max) - 385) . 'px;">
                      <span style="position: relative; top: -2px;">' . $data[2] . '/' . $max . '</span>
                    </td>
                  </tr>';
            }
            $output .= '
                </table>
                <br />
              </div>
              <br />
            </div>
            <br />
            <table class="hidden center">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton(lang("char", "chars_acc"), 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"]) {
                //makebutton($lang_char["edit_button"], 'char_edit.php?id='.$id.'&amp;realm='.$realmid.'', 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission["delete"] || $owner_name === $user_name) {
                makebutton(lang("char", "del_char"), 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission["update"]) {
                makebutton(lang("char", "send_mail"), 'mail.php?type=ingame_mail&amp;to=' . $char["name"] . '', 130);
                $output .= '
                </td>
                <td>';
            }
            makebutton(lang("global", "back"), 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          <!-- end of char_achieve.php -->';
        } else {
            error(lang("char", "no_permission"));
        }
    } else {
        error(lang("char", "no_char_found"));
    }
}
Exemplo n.º 22
0
function GraphSonda($chart, $id_chart, $id_plan, $id_item, $from, $avg, $tag)
{
    $offset = getOffset();
    // setTimezone();
    $dt = getDates($from);
    $index = 0;
    $average = getAverage($avg);
    $format = $average[0];
    $divide = $average[1];
    if ($divide == 60 * 60 * 6) {
        $offset = -60 * 60 * 2;
    }
    if ($divide == 60 * 60 * 12) {
        $offset = +60 * 60 * 4;
    }
    if ($divide == 60 * 60 * 24) {
        $offset = +60 * 60 * 4;
    }
    $colorIndex = 0;
    $ldata = loadRAWData($from, $id_plan, $id_item);
    $percentile = calculatePercentile($ldata['allData']);
    $div = $ldata['div'];
    if (isset($ldata['hostList'])) {
        foreach ($ldata['hostList'] as $host) {
            $id_host = $host['id_host'];
            $hostName = $host['host'];
            $nacD = $host['nacD'];
            $nacU = $host['nacU'];
            $critical = $host['critical'];
            $warning = $host['warning'];
            $nominal = $host['nominal'];
            if ($warning > 100) {
                $dir = 1;
            } else {
                $dir = 0;
            }
            if ($nominal == -1) {
                $nominal = $nacD;
            }
            if ($nominal == -2) {
                $nominal = $nacU;
            }
            unset($theSondaAvg);
            unset($theSondaQoE);
            unset($dataAvg);
            unset($dataQoE);
            if (isset($ldata['historyList'][$id_host])) {
                foreach ($ldata['historyList'][$id_host] as $key => $row) {
                    $tk = round($row['clock'] / $divide, 0) * $divide;
                    $skip = false;
                    if (isset($_SESSION['filter']['P95']) && $row['value'] > $percentile['P95']) {
                        $skip = true;
                    }
                    if (isset($_SESSION['filter']['P5']) && $row['value'] < $percentile['P5']) {
                        $skip = true;
                    }
                    if (!$skip) {
                        if (!isset($theSondaAvg[$tk])) {
                            $theSondaAvg[$tk] = array($tk, 0, 0);
                        }
                        if (!isset($theSondaQoE[$tk])) {
                            $theSondaQoE[$tk] = array($tk, 0, 0);
                        }
                        $sum = $theSondaAvg[$tk][1];
                        $cnt = $theSondaAvg[$tk][2];
                        $x = $sum + $row['value'];
                        $y = $cnt + 1;
                        $theSondaAvg[$tk] = array($tk, $x, $y);
                        if ($row['value'] > $nominal) {
                            $row['value'] = $nominal;
                        }
                        $sum = $theSondaQoE[$tk][1];
                        $cnt = $theSondaQoE[$tk][2];
                        $x = $sum + $row['value'];
                        $y = $cnt + 1;
                        $theSondaQoE[$tk] = array($tk, $x, $y);
                    }
                }
            }
            if (isset($theSondaAvg)) {
                aasort($theSondaAvg, 0);
                $next = 0;
                $prev = 0;
                foreach ($theSondaAvg as $tvalue) {
                    $next = $tvalue[0] + $offset;
                    if ($prev > 0 && $next > 0 && $next - $prev > $divide * 2) {
                        $dataAvg[] = array(($prev + 1000) * 1000, null);
                    }
                    $dataAvg[] = array($next * 1000, round($tvalue[1] / $tvalue[2] / $div, 2));
                    $prev = $next;
                }
                aasort($theSondaQoE, 0);
                $next = 0;
                $prev = 0;
                foreach ($theSondaQoE as $tvalue) {
                    $next = $tvalue[0] + $offset;
                    if ($prev > 0 && $next > 0 && $next - $prev > $divide * 2) {
                        $dataQoE[] = array(($prev + 1000) * 1000, null);
                    }
                    $dataQoE[] = array($next * 1000, round($tvalue[1] / $tvalue[2] / $div, 2));
                    $prev = $next;
                }
            }
            if (isset($dataAvg)) {
                if (!isset($minClock)) {
                    $minClock = $dataAvg[0][0];
                    $maxClock = $dataAvg[count($dataAvg) - 1][0];
                } else {
                    if ($dataAvg[0][0] < $minClock) {
                        $minClock = $dataAvg[0][0];
                    }
                    if ($dataAvg[count($dataAvg) - 2][0] > $maxClock) {
                        $maxClock = $dataAvg[count($dataAvg) - 2][0];
                    }
                }
                if ($_GET['qoe'] == 'Average On' || $_GET['qoe'] == 'Both') {
                    $chart->series[]->name = $hostName . "-AVG";
                    $chart->series[$index]->type = 'spline';
                    $chart->series[$index]->dashStyle = 'spline';
                    $chart->series[$index]->data = $dataAvg;
                    $chart->series[$index]->color = getColor($colorIndex);
                    $chart->series[$index]->lineWidth = 1;
                    $chart->series[$index]->marker->radius = 2;
                    $index++;
                }
                if ($_GET['qoe'] == 'QoE On' || $_GET['qoe'] == 'Both') {
                    $chart->series[]->name = $hostName . '-QoE';
                    $chart->series[$index]->type = 'shortdot';
                    $chart->series[$index]->color = getColor($colorIndex);
                    $chart->series[$index]->data = $dataQoE;
                    $chart->series[$index]->lineWidth = 1;
                    $chart->series[$index]->marker->radius = 2;
                    $index++;
                }
                $colorIndex++;
            }
        }
    }
    $title = 'Sondas for "' . $ldata['item'] . '" on plan "' . $ldata['plan'] . '"';
    $subtitle = 'From ' . $ldata['from'] . ' to ' . $ldata['to'];
    $chart = chartHeader($chart, $id_chart, $title, $subtitle, $ldata['unit'], null);
    if (!isset($minClock)) {
        $minClock = 0;
        $maxClock = 0;
    }
    $chart->xAxis->type = 'datetime';
    $chart->tooltip->formatter = new HighchartJsExpr("\n            function() {\n                var s = '<b>'+ Highcharts.dateFormat('%e. %b %H:%M',this.x) +'</b>';    \n                \$.each(this.points, function(i, point) {\n                    s += '<br/><span style=\"color:'+point.series.color+'\">'+ point.series.name +': '+ point.y +' " . $ldata['unit'] . "</span><b>';\n                });\n                return s;\n            }");
    echo "\n" . '<script> function redraw() { chart1.xAxis[0].setExtremes(' . $minClock . ', ' . (round($maxClock / (3600 * 24), 0) * 3600 * 24 + $divide * 1000) . ');}  </script>';
    //var_dump($chart->chart);
    return $chart;
}
Exemplo n.º 23
0
 public function search_articles($q, $topic_ids = null, $page = 1, $limit = 20)
 {
     if ($topic_ids) {
         $topic_ids = explode(',', $topic_ids);
         array_walk_recursive($topic_ids, 'intval_string');
         $where = "id IN(SELECT item_id FROM " . $this->get_table('topic_relation') . " WHERE topic_id IN(" . implode(',', $topic_ids) . ") AND `type` = 'article')";
     }
     $search_hash = $this->get_search_hash('article', 'title', $q, $where);
     if (!($result = $this->fetch_cache($search_hash))) {
         if ($result = $this->query_all($this->bulid_query('article', 'title', $q, $where), $this->max_results)) {
             $result = aasort($result, 'score', 'DESC');
         } else {
             return false;
         }
         $this->save_cache($search_hash, $result);
     }
     if (!$page) {
         $slice_offset = 0;
     } else {
         $slice_offset = ($page - 1) * $limit;
     }
     return array_slice($result, $slice_offset, $limit);
 }
Exemplo n.º 24
0
function searchIps($search, $serverID, $server, $sortByCol = 'name', $sortBy = 'ASC', $past = true)
{
    global $settings;
    $found = array();
    switch ($sortByCol) {
        default:
        case 0:
            // Name
            $sort['bans'] = $sort['banrecords'] = 'b.id';
            break;
        case 1:
            // Type
            $sortByType = true;
            $sort['bans'] = $sort['banrecords'] = 'b.id';
            break;
        case 2:
            // By
            $sort['bans'] = $sort['banrecords'] = 'actor_id';
            break;
        case 3:
            // Reason
            $sort['bans'] = $sort['banrecords'] = 'reason';
            break;
        case 4:
            // Expires
            $sort['bans'] = 'expires';
            $sort['banrecords'] = 'expired';
            break;
        case 5:
            // Date
            $sort['bans'] = $sort['banrecords'] = 'created';
            break;
    }
    if ($search == "%") {
        $whereStatement = "";
    } else {
        // Check if search contains a "-", aka range search
        if (strpos($search, '-') == true) {
            $searchIPs = explode("-", $search);
            // Make sure we only have two IP elements
            if (count($searchIPs) == 2) {
                $whereStatement = "WHERE ip BETWEEN INET_ATON('" . completeIPaddress($searchIPs[0], "start") . "') AND INET_ATON('" . completeIPaddress($searchIPs[1], "end") . "')";
            } else {
                return false;
            }
        } else {
            // Check if IP is complete, if not complete and turn into range query
            if ($search != completeIPaddress($search, "start")) {
                $whereStatement = "WHERE ip BETWEEN INET_ATON('" . completeIPaddress($search, "start") . "') AND INET_ATON('" . completeIPaddress($search, "end") . "')";
                // Otherwise search for exact IP
            } else {
                $whereStatement = "WHERE ip = INET_ATON('" . $search . "')";
            }
        }
    }
    // Found results
    $found = array();
    // Current Bans
    $result = cache("SELECT b.ip, a.name AS actor_name, b.reason, b.created, b.expires FROM " . $server['ipBansTable'] . " b JOIN " . $server['playersTable'] . " a ON b.actor_id = a.id " . $whereStatement . " ORDER BY " . $sort['bans'] . " {$sortBy}", $settings['cache_search'], $serverID . '/search', $server);
    if (isset($result[0]) && !is_array($result[0]) && !empty($result[0])) {
        $result = array($result);
    }
    if ($result && count($result) > 0) {
        foreach ($result as $r) {
            array_push($found, array('ip' => long2ip($r['ip']), 'by' => $r['actor_name'], 'reason' => $r['reason'], 'type' => 'IP Ban', 'time' => $r['created'], 'expires' => $r['expires']));
        }
    }
    if ($past) {
        // Past Bans
        $result = cache("SELECT b.ip, a.name AS actor_name, b.reason, b.created, b.expired FROM " . $server['ipBanRecordsTable'] . " b JOIN " . $server['playersTable'] . " a ON b.actor_id = a.id " . $whereStatement . " ORDER BY " . $sort['banrecords'] . " {$sortBy}", $settings['cache_search'], $serverID . '/search', $server);
        if (isset($result[0]) && !is_array($result[0]) && !empty($result[0])) {
            $result = array($result);
        }
        if ($result && count($result) > 0) {
            foreach ($result as $r) {
                if (!isset($found[long2ip($r['ip'])])) {
                    array_push($found, array('ip' => long2ip($r['ip']), 'by' => $r['actor_name'], 'reason' => $r['reason'], 'type' => 'IP Ban', 'time' => $r['created'], 'expires' => $r['expired'], 'past' => true));
                } else {
                    if ($found[long2ip($r['ip'])]['created'] < $r['created']) {
                        array_push($found, array('ip' => long2ip($r['ip']), 'by' => $r['actor_name'], 'reason' => $r['reason'], 'type' => 'IP Ban', 'time' => $r['created'], 'expires' => $r['expired'], 'past' => false));
                    }
                }
            }
        }
    }
    switch ($sortByCol) {
        default:
        case 0:
            // Name
            aasort($found, "ip", $sortBy);
            break;
        case 1:
            // Type
            aasort($found, "type", $sortBy);
            break;
        case 2:
            // By
            aasort($found, "by", $sortBy);
            break;
        case 3:
            // Reason
            aasort($found, "reason", $sortBy);
            break;
        case 4:
            // Expires
            aasort($found, "expires", $sortBy);
            break;
        case 5:
            // Date
            aasort($found, "time", $sortBy);
            break;
    }
    if (count($found) == 0) {
        return false;
    } else {
        if (count($found) == 1) {
            // Redirect!
            $p = array_keys($found);
            redirect('index.php?action=viewip&ip=' . $p[0] . '&server=' . $serverID);
        } else {
            // STUFF
            return $found;
        }
    }
}
Exemplo n.º 25
0
function sortJSON($arr)
{
    $arrOffline = array();
    $arrLogin = array();
    // split into 2 array
    foreach ($arr as $key => $agent) {
        if ($agent['agentstatus'] == 'offline') {
            $arrOffline[$key] = $arr[$key];
        } else {
            $arrLogin[$key] = $arr[$key];
        }
    }
    // Sort sec_calls of Offline agent
    aasort($arrOffline, 'num_calls');
    // Merg 2 array
    return array_merge($arrLogin, $arrOffline);
}
Exemplo n.º 26
0
function char_quest(&$sqlr, &$sqlc)
{
    global $output, $lang_global, $lang_char, $realm_id, $world_db, $characters_db, $action_permission, $user_lvl, $user_name, $quest_datasite, $itemperpage;
    wowhead_tt();
    if (empty($_GET['id'])) {
        error($lang_global['empty_fields']);
    }
    if (empty($_GET['realm'])) {
        $realmid = $realm_id;
    } else {
        $realmid = $sqlr->quote_smart($_GET['realm']);
        if (is_numeric($realmid)) {
            $sqlc->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name']);
        } else {
            $realmid = $realm_id;
        }
    }
    $id = $sqlc->quote_smart($_GET['id']);
    if (is_numeric($id)) {
    } else {
        $id = 0;
    }
    //==========================$_GET and SECURE=================================
    $start = isset($_GET['start']) ? $sqlc->quote_smart($_GET['start']) : 0;
    if (is_numeric($start)) {
    } else {
        $start = 0;
    }
    $order_by = isset($_GET['order_by']) ? $sqlc->quote_smart($_GET['order_by']) : 1;
    if (is_numeric($order_by)) {
    } else {
        $order_by = 1;
    }
    $dir = isset($_GET['dir']) ? $sqlc->quote_smart($_GET['dir']) : 0;
    if (preg_match('/^[01]{1}$/', $dir)) {
    } else {
        $dir = 0;
    }
    $order_dir = $dir ? 'ASC' : 'DESC';
    $dir = $dir ? 0 : 1;
    //==========================$_GET and SECURE end=============================
    $result = $sqlc->query('SELECT account, name, race, class, level, gender
    FROM characters WHERE guid = ' . $id . ' LIMIT 1');
    if ($sqlc->num_rows($result)) {
        $char = $sqlc->fetch_assoc($result);
        $owner_acc_id = $sqlc->result($result, 0, 'account');
        $result = $sqlr->query('SELECT gmlevel, username FROM account WHERE id = ' . $char['account'] . '');
        $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel');
        $owner_name = $sqlr->result($result, 0, 'username');
        if ($user_lvl > $owner_gmlvl || $owner_name === $user_name) {
            $output .= '
          <center>
           <div id="tab_content">
              <div id="tab">
                <ul>
                  <li><a href="char.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['char_sheet'] . '</a></li>
                  <li><a href="char_inv.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['inventory'] . '</a></li>
                  <li><a href="char_extra.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['extra'] . '</a></li>
                  ' . ($char['level'] < 10 ? '' : '<li><a href="char_talent.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['talents'] . '</a></li>') . '
                  <li><a href="char_achieve.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['achievements'] . '</a></li>
                  <li><a href="char_rep.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['reputation'] . '</a></li>
                  <li><a href="char_skill.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['skills'] . '</a></li>';
            if (char_get_class_name($char['class']) === 'Hunter') {
                $output .= '
                  <li><a href="char_pets.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['pets'] . '</a></li>';
            }
            $output .= '
                  <li><a href="char_friends.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['friends'] . '</a></li>
				  <li><a href="char_spell.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['spells'] . '</a></li>
				  <li><a href="char_mail.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['mail'] . '</a></li>
                </ul>
                <ul>';
            // selected char tab at last
            $output .= '
                  <li id="selected"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '">' . $lang_char['quests'] . '</a></li>';
            $output .= '
              </ul>
            </div>
            <div id="tab_content2">
              <font class="bold">
                ' . htmlentities($char['name']) . ' -
                <img src="img/c_icons/' . $char['race'] . '-' . $char['gender'] . '.gif"
                  onmousemove="toolTip(\'' . char_get_race_name($char['race']) . '\', \'item_tooltip\')" onmouseout="toolTip()" alt="" />
                <img src="img/c_icons/' . $char['class'] . '.gif"
                  onmousemove="toolTip(\'' . char_get_class_name($char['class']) . '\',\'item_tooltip\')" onmouseout="toolTip()" alt="" /> - lvl ' . char_get_level_color($char['level']) . '
              </font>
              <br /><br />
              <table class="lined" style="width: 550px;">
                <tr>
                  <th width="10%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_id'] . '</a></th>
                  <th width="7%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_level'] . '</a></th>
                  <th width="78%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_title'] . '</a></th>
                  <th width="5%"><img src="img/aff_qst.png" width="14" height="14" border="0" alt="" /></th>
                </tr>';
            $result = $sqlc->query('SELECT quest, status, rewarded FROM character_queststatus WHERE guid = ' . $id . ' AND ( status = 3 OR status = 1 ) ORDER BY status DESC');
            $quests_1 = array();
            $quests_3 = array();
            if ($sqlc->num_rows($result)) {
                while ($quest = $sqlc->fetch_assoc($result)) {
                    $deplang = get_lang_id();
                    $query1 = $sqlc->query('SELECT QuestLevel, IFNULL(' . ($deplang != 0 ? '`title_loc' . $deplang . '`' : 'NULL') . ', title) as Title FROM `' . $world_db[$realmid]['name'] . '`.`quest_template` LEFT JOIN `' . $world_db[$realmid]['name'] . '`.`locales_quest` ON `quest_template`.`entry` = `locales_quest`.`entry` WHERE `quest_template`.`entry` = \'' . $quest['quest'] . '\'');
                    $quest_info = $sqlc->fetch_assoc($query1);
                    if (1 == $quest['status']) {
                        array_push($quests_1, array($quest['quest'], $quest_info['QuestLevel'], $quest_info['Title'], $quest['rewarded']));
                    } else {
                        array_push($quests_3, array($quest['quest'], $quest_info['QuestLevel'], $quest_info['Title']));
                    }
                }
                unset($quest);
                unset($quest_info);
                aasort($quests_1, $order_by, $dir);
                $orderby = $order_by;
                if (2 < $orderby) {
                    $orderby = 1;
                }
                aasort($quests_3, $orderby, $dir);
                $all_record = count($quests_1);
                foreach ($quests_3 as $data) {
                    $output .= '
                <tr>
                  <td>' . $data[0] . '</td>
                  <td>(' . $data[1] . ')</td>
                  <td align="left"><a href="' . $quest_datasite . $data[0] . '" target="_blank">' . htmlentities($data[2]) . '</a></td>
                  <td><img src="img/aff_qst.png" width="14" height="14" alt="" /></td>
                </tr>';
                }
                unset($quest_3);
                if (count($quests_1)) {
                    $output .= '
              </table>
              <table class="hidden" style="width: 550px;">
                <tr align="right">
                  <td>';
                    $output .= generate_pagination('char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=' . $order_by . '&amp;dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
                    $output .= '
                  </td>
                </tr>
              </table>
              <table class="lined" style="width: 550px;">
                <tr>
                  <th width="10%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=0&amp;dir=' . $dir . '"' . ($order_by == 0 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_id'] . '</a></th>
                  <th width="7%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=1&amp;dir=' . $dir . '"' . ($order_by == 1 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_level'] . '</a></th>
                  <th width="68%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=2&amp;dir=' . $dir . '"' . ($order_by == 2 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['quest_title'] . '</a></th>
                  <th width="10%"><a href="char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=3&amp;dir=' . $dir . '"' . ($order_by == 3 ? ' class="' . $order_dir . '"' : '') . '>' . $lang_char['rewarded'] . '</a></th>
                  <th width="5%"><img src="img/aff_tick.png" width="14" height="14" border="0" alt="" /></th>
                </tr>';
                    $i = 0;
                    foreach ($quests_1 as $data) {
                        if ($i < $start + $itemperpage && $i >= $start) {
                            $output .= '
                <tr>
                  <td>' . $data[0] . '</td>
                  <td>(' . $data[1] . ')</td>
                  <td align="left"><a href="' . $quest_datasite . $data[0] . '" target="_blank">' . htmlentities($data[2]) . '</a></td>
                  <td><img src="img/aff_' . ($data[3] ? 'tick' : 'qst') . '.png" width="14" height="14" alt="" /></td>
                  <td><img src="img/aff_tick.png" width="14" height="14" alt="" /></td>
                </tr>';
                        }
                        $i++;
                    }
                    unset($data);
                    unset($quest_1);
                    $output .= '
                <tr align="right">
                  <td colspan="5">';
                    $output .= generate_pagination('char_quest.php?id=' . $id . '&amp;realm=' . $realmid . '&amp;start=' . $start . '&amp;order_by=' . $order_by . '&amp;dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
                    $output .= '
                  </td>
                </tr>';
                }
            } else {
                $output .= '
                <tr>
                  <td colspan="4"><p>' . $lang_char['no_act_quests'] . '</p></td>
                </tr>';
            }
            //---------------Page Specific Data Ends here----------------------------
            //---------------Character Tabs Footer-----------------------------------
            $output .= '
              </table>
            </div>
            </div>
            <br />
            <table class="hidden">
              <tr>
                <td>';
            // button to user account page, user account page has own security
            makebutton($lang_char['chars_acc'], 'user.php?action=edit_user&amp;id=' . $owner_acc_id . '', 130);
            $output .= '
                </td>
                <td>';
            // only higher level GM with delete access can edit character
            //  character edit allows removal of character items, so delete permission is needed
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete']) {
                makebutton($lang_char['edit_button'], 'char_edit.php?id=' . $id . '&amp;realm=' . $realmid . '', 130);
                $output .= '
                </td>
                <td>';
            }
            // only higher level GM with delete access, or character owner can delete character
            if ($user_lvl > $owner_gmlvl && $user_lvl >= $action_permission['delete'] || $owner_name === $user_name) {
                makebutton($lang_char['del_char'], 'char_list.php?action=del_char_form&amp;check%5B%5D=' . $id . '" type="wrn', 130);
                $output .= '
                </td>
                <td>';
            }
            // only GM with update permission can send mail, mail can send items, so update permission is needed
            if ($user_lvl >= $action_permission['update']) {
                makebutton($lang_char['send_mail'], 'mail.php?type=ingame_mail&amp;to=' . $char['name'] . '', 130);
                $output .= '
                </td>
                <td>';
            }
            makebutton($lang_global['back'], 'javascript:window.history.back()" type="def', 130);
            $output .= '
                </td>
              </tr>
            </table>
            <br />
          </center>
          <!-- end of char_quest.php -->';
        } else {
            error($lang_char['no_permission']);
        }
    } else {
        error($lang_char['no_char_found']);
    }
}
Exemplo n.º 27
0
            $order_supplier[$current_order][$sup_key]['place'] = $supplier['place'];
            $order_supplier[$current_order][$sup_key]['art'] = $supplier['art'];
        }
    }
}
$tpl->Assign("os", $order_supplier);
$tpl->Assign("sorders", $supplier_order);
$tpl->Assign("orders", $orders_data);
$tpl->Assign("contragent", $contragent_data);
function aasort(&$array, $key)
{
    $sorter = array();
    $ret = array();
    reset($array);
    foreach ($array as $ii => $va) {
        $sorter[$ii] = $va[$key];
    }
    asort($sorter, SORT_STRING);
    foreach ($sorter as $ii => $va) {
        $ret[$ii] = $array[$ii];
    }
    $array = $ret;
}
aasort($suppliers_data, "art");
$tpl->Assign('suppliers', $suppliers_data);
$suppliers_altern = array();
$Order->GetSuppliersAltern($order_id);
$suppliers_altern = $Order->list;
$tpl->Assign('suppliers_altern', $suppliers_altern);
echo $tpl->Parse($GLOBALS['PATH_tpl'] . 'composed_invoice.tpl');
exit(0);
Exemplo n.º 28
0
<?php

/* Module Loader */
$lethe_modules = array();
include_once LETHE_MODULES . '/lethe.autoresponder/module.conf.php';
include_once LETHE_MODULES . '/lethe.newsletter/module.conf.php';
include_once LETHE_MODULES . '/lethe.organizations/module.conf.php';
include_once LETHE_MODULES . '/lethe.subscribers/module.conf.php';
include_once LETHE_MODULES . '/lethe.templates/module.conf.php';
aasort($lethe_modules, 'sort');
Exemplo n.º 29
0
 public function get_related_question_list($question_id, $question_content, $limit = 10)
 {
     $cache_key = 'question_related_list_' . md5($question_content) . '_' . $limit;
     if ($question_related_list = AWS_APP::cache()->get($cache_key)) {
         return $question_related_list;
     }
     if ($question_keywords = $this->model('system')->analysis_keyword($question_content)) {
         if (sizeof($question_keywords) <= 1) {
             return false;
         }
         if ($question_list = $this->query_all($this->model('search_fulltext')->bulid_query('question', 'question_content', $question_keywords), 2000)) {
             $question_list = aasort($question_list, 'score', 'DESC');
             $question_list = aasort($question_list, 'agree_count', 'DESC');
             $question_list = array_slice($question_list, 0, $limit + 1);
             foreach ($question_list as $key => $val) {
                 if ($val['question_id'] == $question_id) {
                     unset($question_list[$key]);
                 } else {
                     if (!isset($question_related[$val['question_id']])) {
                         $question_related[$val['question_id']] = $val['question_content'];
                         $question_info[$val['question_id']] = $val;
                     }
                 }
             }
         }
     }
     if ($question_related) {
         foreach ($question_related as $key => $question_content) {
             $question_related_list[] = array('question_id' => $key, 'question_content' => $question_content, 'answer_count' => $question_info[$key]['answer_count']);
         }
     }
     if (sizeof($question_related) > $limit) {
         array_pop($question_related);
     }
     AWS_APP::cache()->set($cache_key, $question_related_list, get_setting('cache_level_low'));
     return $question_related_list;
 }
function pp_shortcode_generator_options()
{
    $plugin_url = get_stylesheet_directory_uri() . '/plugins/shortcode_generator';
    //Get all galleries
    $args = array('numberposts' => -1, 'post_type' => array('galleries'));
    $galleries_arr = get_posts($args);
    $galleries_select = array();
    $galleries_select[''] = '';
    foreach ($galleries_arr as $gallery) {
        $galleries_select[$gallery->ID] = $gallery->post_title;
    }
    //Get all client categories
    $client_cat_arr = get_terms('clientcats', 'hide_empty=0&hierarchical=0&parent=0');
    $client_cat_select = array();
    $client_cat_select[''] = '';
    foreach ($client_cat_arr as $client_cat) {
        $client_cat_select[$client_cat->slug] = $client_cat->name;
    }
    //Get all testimonials categories
    $testimonial_cat_arr = get_terms('testimonialcats', 'hide_empty=0&hierarchical=0&parent=0');
    $testimonial_cat_select = array();
    $testimonial_cat_select[''] = '';
    foreach ($testimonial_cat_arr as $testimonial_cat) {
        $testimonial_cat_select[$testimonial_cat->slug] = $testimonial_cat->name;
    }
    //Get all button colors options
    $button_color_arr = array('black' => 'black', 'grey' => 'grey', 'blue' => 'blue', 'yellow' => 'yellow', 'red' => 'red', 'orange' => 'orange', 'dark blue' => 'dark blue', 'green' => 'green', 'emerald' => 'emerald', 'pink' => 'pink', 'purple' => 'purple');
    //Begin shortcode array
    $shortcodes = array('dropcap' => array('name' => 'Dropcap', 'attr' => array(), 'desc' => array(), 'content' => TRUE), 'quote' => array('name' => 'Quote Text', 'attr' => array(), 'desc' => array(), 'content' => TRUE), 'tg_button' => array('name' => 'Button', 'attr' => array('href' => 'text', 'color' => 'select', 'bg_color' => 'text', 'text_color' => 'text'), 'desc' => array('href' => 'Enter URL for button', 'color' => 'Select predefined button colors', 'bg_color' => 'Enter custom button background color code ex. #4ec380', 'text_color' => 'Enter custom button text color code ex. #ffffff'), 'options' => $button_color_arr, 'content' => TRUE, 'content_text' => 'Enter text on button'), 'tg_alert_box' => array('name' => 'Alert Box', 'attr' => array('style' => 'select'), 'desc' => array('style' => 'Select content style'), 'options' => array('error' => 'error', 'success' => 'success', 'notice' => 'notice'), 'content' => TRUE), 'one_half' => array('name' => 'One Half Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE, 'repeat' => 1), 'one_half_last' => array('name' => 'One Half Last Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE, 'repeat' => 1), 'one_third' => array('name' => 'One Third Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE, 'repeat' => 2), 'one_third_last' => array('name' => 'One Third Last Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE), 'two_third' => array('name' => 'Two Third Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE), 'two_third_last' => array('name' => 'Two Third Last Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE), 'one_fourth' => array('name' => 'One Fourth Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE, 'repeat' => 3), 'one_fifth' => array('name' => 'One Fifth Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE, 'repeat' => 4), 'one_sixth' => array('name' => 'One Sixth Column', 'attr' => array(), 'desc' => array(), 'content' => TRUE, 'repeat' => 5), 'one_half_bg' => array('name' => 'One Half Column With Background', 'attr' => array('bg' => 'text'), 'desc' => array('bg' => 'Enter background image URL'), 'content' => TRUE), 'one_third_bg' => array('name' => 'One Third Column With Background', 'attr' => array('bg' => 'text'), 'desc' => array('bg' => 'Enter background image URL'), 'content' => TRUE), 'two_third_bg' => array('name' => 'Two Third Column With Background', 'attr' => array('bg' => 'text'), 'desc' => array('bg' => 'Enter background image URL'), 'content' => TRUE), 'one_fourth_bg' => array('name' => 'One Fourth Column With Background', 'attr' => array('bg' => 'text'), 'desc' => array('bg' => 'Enter background image URL'), 'content' => TRUE), 'tg_map' => array('name' => 'Google Map', 'attr' => array('type' => 'select', 'width' => 'text', 'height' => 'text', 'lat' => 'text', 'long' => 'text', 'zoom' => 'text', 'popup' => 'text'), 'desc' => array('type' => 'Select map display type', 'width' => 'Map width in pixels', 'height' => 'Map height in pixels', 'lat' => 'Map latitude <a href="http://www.tech-recipes.com/rx/5519/the-easy-way-to-find-latitude-and-longitude-values-in-google-maps/">Find here</a>', 'long' => 'Map longitude <a href="http://www.tech-recipes.com/rx/5519/the-easy-way-to-find-latitude-and-longitude-values-in-google-maps/">Find here</a>', 'zoom' => 'Enter zoom number (1-16)', 'popup' => 'Enter text to display as popup above location on map for example. your company name'), 'content' => FALSE, 'options' => array('MapTypeId.ROADMAP' => 'Roadmap', 'MapTypeId.SATELLITE' => 'Satellite', 'MapTypeId.HYBRID' => 'Hybrid', 'MapTypeId.TERRAIN' => 'Terrain')), 'googlefont_func' => array('name' => 'Google Font', 'attr' => array('font' => 'text', 'fontsize' => 'text'), 'desc' => array('font' => 'Enter Google Web Font Name you want to use', 'fontsize' => 'Enter font size in pixels'), 'content' => FALSE), 'tg_gallery_slider' => array('name' => 'Gallery Slider', 'attr' => array('gallery_id' => 'select'), 'options' => $galleries_select, 'desc' => array('gallery_id' => 'Select gallery you want to display its images'), 'content' => FALSE), 'tg_social_icons' => array('name' => 'Social Icons', 'attr' => array('style' => 'select', 'size' => 'text'), 'options' => array('dark' => 'Dark', 'light' => 'Light'), 'desc' => array('style' => 'Select color style for social icons', 'size' => 'Enter icon size between small and large'), 'content' => FALSE), 'tg_promo_box' => array('name' => 'Promo Box', 'attr' => array('title' => 'text', 'border' => 'text', 'shadow' => 'select', 'button_text' => 'text', 'button_url' => 'text'), 'options' => array(0 => 'No Shadow', 1 => 'Display Shadow'), 'desc' => array('title' => 'Enter promo box title', 'border' => 'Enter border color code. For example #3facd6', 'shadow' => 'Select "Display Shadow" if you want to display promo box drop shadow', 'button_text' => 'Enter promo box button text. For example More Info', 'button_url' => 'Enter promo box button link URL'), 'content' => TRUE), 'tg_accordion' => array('name' => 'Accordion & Toggle', 'attr' => array('title' => 'text', 'icon' => 'text', 'close' => 'select'), 'desc' => array('title' => 'Enter Accordion\'s title', 'icon' => 'Enter icon class name ex. fa-star. <a href="http://fontawesome.io/cheatsheet/">See all possible here</a>', 'close' => 'Select default status (close or open)'), 'content' => TRUE, 'options' => array(0 => 'Open', 1 => 'Close')), 'tg_image' => array('name' => 'Image Animation', 'attr' => array('src' => 'text', 'animation' => 'select'), 'desc' => array('src' => 'Enter image URL', 'animation' => 'Select animation type'), 'content' => TRUE, 'options' => array('slideRight' => 'Slide Right', 'slideLeft' => 'Slide Left', 'slideUp' => 'Slide Up', 'fadeIn' => 'Fade In'), 'content' => FALSE), 'tg_divider' => array('name' => 'Divider', 'attr' => array('style' => 'select'), 'desc' => array('style' => 'Select HR divider style'), 'options' => array('normal' => 'Normal', 'thick' => 'Thick', 'dotted' => 'Dotted', 'dashed' => 'Dashed', 'faded' => 'Faded', 'totop' => 'Go To Top'), 'content' => FALSE), 'tg_teaser' => array('name' => 'Image Teaser', 'attr' => array('columns' => 'select', 'image' => 'text', 'title' => 'text', 'align' => 'text'), 'desc' => array('columns' => 'Select ligthbox content type', 'image' => 'Enter full image URL', 'title' => 'Enter teaser title', 'align' => 'Enter teaser content text align from left, center and right'), 'options' => array('one' => 'Fullwidth', 'one_half' => 'One Half', 'one_half last' => 'One Half Last', 'one_third' => 'One Third', 'one_half last' => 'One Third Last', 'one_fourth' => 'One Fourth', 'one_fourth last' => 'One Fourth Last'), 'content' => TRUE), 'tg_lightbox' => array('name' => 'Media Lightbox', 'attr' => array('type' => 'select', 'src' => 'text', 'href' => 'text', 'vimeo_id' => 'text', 'youtube_id' => 'text'), 'desc' => array('type' => 'Select ligthbox content type', 'src' => 'Enter lightbox preview image URL', 'href' => 'If you selected "Image". Enter full image URL here', 'vimeo_id' => 'If you selected "Vimeo". Enter Vimeo video ID here ex. 82095744', 'youtube_id' => 'If you selected "Youtube". Enter Youtube video ID here ex. hT_nvWreIhg'), 'content' => TRUE, 'options' => array('image' => 'Image', 'vimeo' => 'Vimeo', 'youtube' => 'Youtube'), 'content' => FALSE), 'tg_youtube' => array('name' => 'Youtube Video', 'attr' => array('width' => 'text', 'height' => 'text', 'video_id' => 'text'), 'desc' => array('width' => 'Enter video width in pixels', 'height' => 'Enter video height in pixels', 'video_id' => 'Enter Youtube video ID here ex. hT_nvWreIhg'), 'content' => FALSE), 'tg_vimeo' => array('name' => 'Vimeo Video', 'attr' => array('width' => 'text', 'height' => 'text', 'video_id' => 'text'), 'desc' => array('width' => 'Enter video width in pixels', 'height' => 'Enter video height in pixels', 'video_id' => 'Enter Vimeo video ID here ex. 82095744'), 'content' => FALSE), 'tg_animate_counter' => array('name' => 'Animated Counter', 'attr' => array('start' => 'text', 'end' => 'text', 'fontsize' => 'text', 'fontcolor' => 'text', 'count_subject' => 'text'), 'desc' => array('start' => 'Enter start number ex. 0', 'end' => 'Enter end number ex. 100', 'fontsize' => 'Enter counter number font size in pixel ex. 38', 'fontcolor' => 'Enter counter number font color code ex. #000000', 'count_subject' => 'Enter count subject ex. followers'), 'content' => TRUE), 'tg_animate_bar' => array('name' => 'Animated Progress Bar', 'attr' => array('percent' => 'text', 'color' => 'text'), 'desc' => array('percent' => 'Enter number of percent value (maximum 100)', 'color' => 'Enter progress background color code ex. #000000'), 'content' => TRUE), 'tg_animate_circle' => array('name' => 'Animated Circle', 'attr' => array('percent' => 'text', 'dimension' => 'text', 'width' => 'text', 'color' => 'text', 'fontsize' => 'text', 'subject' => 'text'), 'desc' => array('percent' => 'Enter percent completion number ex. 90', 'dimension' => 'Enter circle dimension ex. 200', 'width' => 'Enter circle border width ex. 10', 'color' => 'Enter circle border color code ex. #000000', 'fontsize' => 'Enter title font size in pixel ex. 38', 'subject' => 'Enter circle subject info ex. completion'), 'content' => TRUE), 'tg_pricing' => array('name' => 'Pricing', 'attr' => array('columns' => 'select', 'items' => 'text'), 'desc' => array('columns' => 'Select Number of Pricing Columns', 'items' => 'Enter number of items you want to display'), 'content' => TRUE, 'options' => array(2 => '2 Columns', 3 => '3 Columns', 4 => '4 Columns'), 'content' => FALSE), 'ppb_client_carousel' => array('name' => 'Client Logo Carousel', 'attr' => array('cat' => 'select', 'items' => 'text'), 'options' => $client_cat_select, 'desc' => array('cat' => 'Select client category you want to display its contents', 'items' => 'Enter number of items you want to display'), 'content' => FALSE), 'tg_team' => array('name' => 'Team', 'attr' => array('columns' => 'select', 'items' => 'text'), 'desc' => array('columns' => 'Select Number of Columns to display', 'items' => 'Enter number of items you want to display'), 'content' => TRUE, 'options' => array(2 => '2 Columns', 3 => '3 Columns', 4 => '4 Columns'), 'content' => FALSE), 'tg_testimonial' => array('name' => 'Testimonials', 'attr' => array('columns' => 'select', 'items' => 'text'), 'desc' => array('columns' => 'Select Number of Columns to display', 'items' => 'Enter number of items you want to display'), 'options' => array(2 => '2 Columns', 3 => '3 Columns', 4 => '4 Columns'), 'content' => FALSE), 'tg_testimonial_slider' => array('name' => 'Testimonials Slider', 'attr' => array('cat' => 'select', 'items' => 'text'), 'desc' => array('cat' => 'Select testimonials category you want to display its contents', 'items' => 'Enter number of items you want to display'), 'options' => $testimonial_cat_select, 'content' => FALSE), 'tg_header' => array('name' => 'Header', 'attr' => array('title' => 'text', 'subtitle' => 'text'), 'desc' => array('title' => 'Enter header title', 'subtitle' => 'Enter header subtitle'), 'content' => FALSE), 'tg_program' => array('name' => 'Tour Program', 'attr' => array('title' => 'text', 'place' => 'text'), 'desc' => array('title' => 'Enter title of tour program ex. Day 1', 'subtitle' => 'Enter tour program places ex. Rome, Venice'), 'content' => TRUE));
    aasort($shortcodes, "name");
    ?>
<script>
function nl2br (str, is_xhtml) {   
	var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';    
	return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
}

jQuery(document).ready(function(){ 
	jQuery('#shortcode_select').change(function() {
  		var target = jQuery(this).val();
  		jQuery('.rm_section').hide()
  		jQuery('#div_'+target).fadeIn()
	});	
	
	jQuery('.code_area').click(function() { 
		document.getElementById(jQuery(this).attr('id')).focus();
    	document.getElementById(jQuery(this).attr('id')).select();
	});
	
	jQuery('.shortcode_button').click(function() { 
		var target = jQuery(this).attr('id');
		var gen_shortcode = '';
  		gen_shortcode+= '['+target;
  		
  		if(jQuery('#'+target+'_attr_wrapper .attr').length > 0)
  		{
  			jQuery('#'+target+'_attr_wrapper .attr').each(function() {
				gen_shortcode+= ' '+jQuery(this).attr('name')+'="'+jQuery(this).val()+'"';
			});
		}
		
		gen_shortcode+= ']';
		
		if(jQuery('#'+target+'_content').length > 0)
  		{
  			gen_shortcode+= jQuery('#'+target+'_content').val()+'[/'+target+']';
  			gen_shortcode+= '\n';
  			
  			var repeat = jQuery('#'+target+'_content_repeat').val();
  			for (count=1;count<=repeat;count=count+1)
			{
				if(count<repeat)
				{
					gen_shortcode+= '['+target+']';
					gen_shortcode+= jQuery('#'+target+'_content').val()+'[/'+target+']';
					gen_shortcode+= '\n';
				}
				else
				{
					gen_shortcode+= '['+target+'_last]';
					gen_shortcode+= jQuery('#'+target+'_content').val()+'[/'+target+'_last]';
					gen_shortcode+= '\n';
				}
			}
  		}
  		jQuery('#'+target+'_code').val(gen_shortcode);
  		jQuery('#pp-insert-to-post').attr('rel', '#'+target+'_code');
  		
  		jQuery("#"+target+"-pp-insert-to-post").click(function() { 
			var current_id = jQuery(this).attr('rel');
			var current_code = jQuery('#'+target+'_code').val();
			
			tinyMCE.activeEditor.selection.setContent(nl2br(current_code));
		});
	});
});
</script>

	<div style="padding:20px 10px 10px 10px">
	<?php 
    if (!empty($shortcodes)) {
        ?>
			<strong>Select Shortcode</strong><hr class="pp_widget_hr">
			<div class="pp_widget_description">Please select short code from list below then enter short code attributes and click "Generate Shortcode". <a href="<?php 
        echo THEMEDEMOURL;
        ?>
" target="_blank">Go to demo site</a> and click "Shortcode" to see all short codes available and their sample code.</div>
			<br/>
			<select id="shortcode_select">
				<option value="">(no short code selected)</option>
			
	<?php 
        foreach ($shortcodes as $shortcode_name => $shortcode) {
            $shortcode_key = $shortcode_name;
            if (isset($shortcodes[$shortcode_name]['name'])) {
                $shortcode_name = $shortcodes[$shortcode_name]['name'];
            }
            ?>
	
			<option value="<?php 
            echo $shortcode_key;
            ?>
"><?php 
            echo $shortcode_name;
            ?>
</option>
	
	<?php 
        }
        ?>
			</select>
	<?php 
    }
    ?>
	
	<br/><br/>
	
	<?php 
    if (!empty($shortcodes)) {
        foreach ($shortcodes as $shortcode_name => $shortcode) {
            ?>
	
			<div id="div_<?php 
            echo $shortcode_name;
            ?>
" class="rm_section" style="display:none">
				<div style="width:47%;float:left">
			
				<div class="rm_title">
					<h3><?php 
            echo ucfirst($shortcode_name);
            ?>
</h3>
					<div class="clearfix"></div>
				</div>
				
				<div class="rm_text" style="padding: 10px 0 20px 0">
				
				<!-- img src="<?php 
            echo $plugin_url . '/' . $shortcode_name . '.png';
            ?>
" alt=""/><br/><br/><br/ -->
				
				<?php 
            if (isset($shortcode['content']) && $shortcode['content']) {
                if (isset($shortcode['content_text'])) {
                    $content_text = $shortcode['content_text'];
                } else {
                    $content_text = 'Your Content';
                }
                ?>
				
				<strong><?php 
                echo $content_text;
                ?>
:</strong><br/><br/>
				<?php 
                if (isset($shortcode['repeat'])) {
                    ?>
					<input type="hidden" id="<?php 
                    echo $shortcode_name;
                    ?>
_content_repeat" value="<?php 
                    echo $shortcode['repeat'];
                    ?>
"/>
				<?php 
                }
                ?>
				<textarea id="<?php 
                echo $shortcode_name;
                ?>
_content" style="width:100%;height:70px" rows="3" wrap="off"></textarea><br/><br/>
				
				<?php 
            }
            ?>
			
				<?php 
            if (isset($shortcode['attr']) && !empty($shortcode['attr'])) {
                ?>
						
						<div id="<?php 
                echo $shortcode_name;
                ?>
_attr_wrapper">
						
				<?php 
                foreach ($shortcode['attr'] as $attr => $type) {
                    ?>
				
							<?php 
                    echo '<strong>' . ucfirst($attr) . '</strong>: ' . $shortcode['desc'][$attr];
                    ?>
<br/><br/>
							
							<?php 
                    switch ($type) {
                        case 'text':
                            ?>
							
									<input type="text" id="<?php 
                            echo $shortcode_name;
                            ?>
_text" style="width:100%" class="attr" name="<?php 
                            echo $attr;
                            ?>
"/>
							
							<?php 
                            break;
                        case 'select':
                            ?>
							
									<select id="<?php 
                            echo $shortcode_name;
                            ?>
_select" style="width:100%" class="attr" name="<?php 
                            echo $attr;
                            ?>
">
									
										<?php 
                            if (isset($shortcode['options']) && !empty($shortcode['options'])) {
                                foreach ($shortcode['options'] as $select_key => $option) {
                                    ?>
										
													<option value="<?php 
                                    echo $select_key;
                                    ?>
"><?php 
                                    echo $option;
                                    ?>
</option>
										
										<?php 
                                }
                            }
                            ?>
							
									
									</select>
							
							<?php 
                            break;
                    }
                    ?>
							
							<br/><br/>
				
				<?php 
                }
                //end attr foreach
                ?>
				
						</div>
				
				<?php 
            }
            ?>
				
				</div>
				
				</div>
				
				<div style="width:47%;float:right">
				
				<strong>Shortcode:</strong><br/><br/>
				<textarea id="<?php 
            echo $shortcode_name;
            ?>
_code" style="width:100%;height:200px" rows="3" readonly="readonly" class="code_area" wrap="off"></textarea>
				
				<br/><br/>
				<input type="button" id="<?php 
            echo $shortcode_name;
            ?>
" value="Generate Shortcode" class="button shortcode_button button-primary"/>
				</div>
				
				<br style="clear:both"/>
			</div>
	
	<?php 
        }
        //end shortcode foreach
    }
    ?>
	
</div>

<?php 
}