コード例 #1
0
ファイル: lib_sc.php プロジェクト: hkenshin/OnLocationMusic
function sc_search($query = '', $limit = 0)
{
    $results = get_results($query, 'soundcloud');
    $results = sort_results($results, $query, 'title');
    if (empty($results) || !is_array($results)) {
        return null;
    }
    $result = $results[0];
    $ret = new stdClass();
    $ret->title = $result->title;
    $ret->url = $result->stream_url . '?client_id=' . CLIENT_ID;
    $ret->score = $result->score;
    //we care because we will run compare it against other service's scores
    return $ret;
}
コード例 #2
0
ファイル: function.php プロジェクト: neillh/Photo-tagging
function get_tags($return_type = '')
{
    $output = '';
    //get results from DB
    $tags = get_results();
    //Do we have a return type and is $tags an array like expected
    if ($return_type != '' && is_array($tags) && $tags != '') {
        if ($return_type == 'styles') {
            $output .= '<style type="text/css">';
            $tag_counter = 1;
            //Build output
            foreach ($tags as $tag) {
                $output .= '.map a.tag_' . $tag_counter . ' { ';
                //$output .= 'border:1px solid #000;';
                $output .= 'background:url(images/tag_hotspot_62x62.png) no-repeat;';
                $output .= 'top:' . $tag['y1'] . 'px;';
                $output .= 'left:' . $tag['x1'] . 'px;';
                //$output .= 'width:'.$tag['width'].'px;';
                //$output .= 'height:'.$tag['height'].'px;';
                $output .= 'width:62px;';
                $output .= 'height:62px;';
                $output .= '}';
                $tag_counter++;
            }
            $output .= '</style>';
        } else {
            if ($return_type == 'map') {
                $tag_counter = 1;
                foreach ($tags as $tag) {
                    $output .= '<li><a class="tag_' . $tag_counter . '" title="' . $tag['title'] . '"><span><b>' . $tag['title'] . '</b></span></a></li>';
                    $tag_counter++;
                }
            } else {
                if ($return_type == 'list') {
                    $title_counter = 1;
                    foreach ($tags as $tag) {
                        $output .= '<li><a href="#" class="title" id="tag_' . $title_counter . '">' . $tag['title'] . '</a> (<a href="includes/function.php?delete=true&amp;id=' . $tag['id'] . '">Delete</a>)</li>';
                        $title_counter++;
                    }
                }
            }
        }
    }
    return $output;
    $output = '';
}
コード例 #3
0
ファイル: reader.php プロジェクト: zivkovicp/genetify
function main()
{
    if (empty($_REQUEST['page'])) {
        die('Page required.');
    }
    //TODO: mysql-php field type mapping... keep ints as ints!
    // $start = microtime();
    // echo microtime() - $start;
    $results = get_results($_REQUEST['domain'], $_REQUEST['page']);
    if (!function_exists('json_encode')) {
        require_once 'JSON.php';
        $json = new Services_JSON();
        $output = $json->encode($results);
    } else {
        $output = json_encode($results);
    }
    $callback = $_REQUEST['callback'] . "({$output})";
    header('Content-type: text/javascript');
    print $callback;
}
コード例 #4
0
ファイル: polls_helper.php プロジェクト: Calit2-UCI/IoT_Map
 /**
  *
  * @param type $params['id_poll']
  * @param type $params['one_poll_place']
  * @return html
  */
 function show_poll_place($id_poll, $one_poll_place)
 {
     $CI =& get_instance();
     $CI->load->model('Polls_model');
     $id_user = $CI->session->userdata('user_id');
     $denied_polls = $CI->Polls_model->get_denied_polls($id_user);
     // Show precise poll
     if ($id_poll) {
         // Check polls existence
         if ($CI->Polls_model->is_exists($id_poll)) {
             // If current user may pass the poll
             if (!in_array($id_poll, $denied_polls)) {
                 return get_form($id_poll, $one_poll_place);
             } else {
                 // Template will decide whether to show results or just a text message
                 if ($one_poll_place || $CI->Polls_model->show_results($id_poll)) {
                     return get_results($id_poll, $one_poll_place);
                 }
                 // else show random poll
             }
         }
         //else show random poll
     } elseif ($one_poll_place) {
         return false;
     }
     // If we reached here, show random poll
     // Get language and user type
     $language = $CI->pg_language->current_lang_id;
     $user_type = $CI->session->userdata("user_type");
     // Pick a random poll...
     $id_poll_rnd = $CI->Polls_model->get_random_id(null, $language, $user_type, $denied_polls);
     if ($id_poll_rnd) {
         return get_form($id_poll_rnd, $one_poll_place);
     } else {
         // ...or results
         $id_poll_rnd = $CI->Polls_model->get_random_id(true);
         if ($id_poll_rnd) {
             return get_results($id_poll_rnd, $one_poll_place);
         }
     }
 }
コード例 #5
0
ファイル: headers.php プロジェクト: paxfactor/testingScripts
            echo "<font style='color:red'>X-frame-options not enabled</font><br>";
        }
    }
    function build_results(&$header)
    {
        // Builds HTML table to display ALL headers;
        echo "<p><h3>Full header results</h3>";
        echo "<table><tr><th>Name</th><th>Value</th>";
        foreach ($header as $headerValue) {
            $headerSplit = explode(": ", $headerValue);
            echo "<tr><td>" . $headerSplit[0] . "</td>";
            echo "<td>" . $headerSplit[1] . "</td></tr>";
        }
        echo "</table>";
    }
    get_results();
    secure_header($header);
    build_results($header);
    ?>
<p>
<form action="headers.php" method="POST">
        <input class="btn" type="submit" name="reset" value="reset">
</form>
<?php 
} else {
    ?>
<!-- This will display upon initial load or resetting page. -->
<h2>Enter domain:</h2>
<form action="headers.php" method="POST">
        <input type="text" name="domain">
        <input class="btn" type="submit" name="submit" value="submit">
コード例 #6
0
ファイル: mobile.php プロジェクト: robertohernando/phpchess
function mobile_get_recent_games($player_id, $oR3DCQuery)
{
    try {
        $dbh = CSession::$dbh;
        // Select the player's games which have been completed. Games are ordered by the most recent move made.
        $query = <<<qq
SELECT
\t`game`.* 
FROM (
\tSELECT 
\t\tMAX(`time`) as 'lastmovetime', `game_id` as 'gameid'
\tFROM 
\t\t`move_history`
\tGROUP BY 
\t\t`game_id`
\t) as subq, `game`
WHERE
\t`game_id` = `gameid` AND 
\t(`w_player_id` = ? OR `b_player_id` = ?) AND 
\t(`completion_status` <> "A" AND `completion_status` <> "I")
ORDER BY
\t`lastmovetime` DESC
LIMIT
\t5
qq;
        $stmt = $dbh->prepare($query);
        $stmt->bind_param('ii', $player_id, $player_id);
        if ($stmt->execute()) {
            $results = get_results($stmt);
            foreach ($results as $result) {
                $next_move = $result['next_move'];
                $completion_status = $result['completion_status'];
                $game_id = $result['game_id'];
                $start_time = $result['start_time'];
                $w_player_id = $result['w_player_id'];
                $b_player_id = $result['b_player_id'];
                $initiator = $result['initiator'];
                echo "<GAMES>\n";
                echo "<STATUS>C";
                echo "</STATUS>\n";
                echo "<COMPLETIONSTATUS>";
                echo $completion_status;
                echo "</COMPLETIONSTATUS>\n";
                $gametypecode = $oR3DCQuery->GetGameTypeCode($game_id);
                $strGameType = "GT_NORMAL_GAME";
                switch ($gametypecode) {
                    case 2:
                        $strGameType = "GT_PASV_RT_GAME";
                        break;
                    case 3:
                        $strGameType = "GT_ACTIVE_RT_GAME";
                        break;
                }
                echo "<GAMETYPE>";
                echo $strGameType;
                echo "</GAMETYPE>\n";
                $oR3DCQuery->GetGamePlayTypeInfoForMobile($game_id);
                $oR3DCQuery->TimedGameStatsForMobile($game_id);
                echo "<TIMECREATED>";
                echo $start_time;
                echo "</TIMECREATED>\n";
                echo "<DESCRIPTION>";
                echo $oR3DCQuery->GetUserIDByPlayerID($ConfigFile, $w_player_id);
                echo " VS ";
                echo $oR3DCQuery->GetUserIDByPlayerID($ConfigFile, $b_player_id);
                echo "</DESCRIPTION>\n";
                echo "<INITIATOR>";
                echo $initiator;
                echo "</INITIATOR>\n";
                echo "<WHITE>";
                echo $w_player_id;
                echo "</WHITE>\n";
                echo "<BLACK>";
                echo $b_player_id;
                echo "</BLACK>\n";
                echo "<NEXTMOVE>";
                echo $next_move;
                echo "</NEXTMOVE>\n";
                echo "<GAMEID>";
                echo $game_id;
                echo "</GAMEID>\n";
                echo "<GAMEFEN>";
                echo $oR3DCQuery->GetFEN3('', $game_id);
                echo "</GAMEFEN>\n";
                echo "</GAMES>\n";
            }
        }
    } catch (mysqli_sql_exception $e) {
        echo "<ERROR>Database Error</ERROR>\n";
    }
}
コード例 #7
0
ファイル: login.php プロジェクト: seelang2/ClassArchive
<?php

include "config.php";
if (isset($_POST['mode']) && $_POST['mode'] != "") {
    $mode = strtoupper($_POST['mode']);
} else {
    $mode = '';
}
switch ($mode) {
    case 'LOGIN':
        $login = $_POST['login'];
        $password = $_POST['password'];
        $query = "SELECT id, login, password, name FROM contact WHERE login = '******' AND password = '******'";
        if (!($result = get_results($query))) {
            echo "<p style=\"color:#FF0000\">The user name or password does not exist or is incorrect.<br />Query: {$query}<br />MySQL Error: " . mysql_error() . "</p>";
        } else {
            $row = $result[0];
            // just want first (and only) result row
            $_SESSION['name'] = $row['name'];
            $_SESSION['id'] = $row['id'];
            header("Location: " . DEFAULT_PAGE);
            exit;
        }
    default:
        include "header.php";
        ?>
<form action="<?php 
        echo $me;
        ?>
" method="post">
<input type="hidden" name="mode" value="login">
コード例 #8
0
ファイル: Term.php プロジェクト: phankimi/WP-Controllers
 public static function distinct_post_terms(array $posts, $fields = '')
 {
     $ids = array();
     foreach ($posts as $post) {
         if (is_numeric($post)) {
             $ids[] = absint($post);
         } elseif (is_a($post, 'WP_Post')) {
             $ids[] = $post->ID;
         } elseif (is_a($post, 'PostController')) {
             $ids[] = $post->id;
         }
     }
     if (empty($ids)) {
         return array();
     }
     global $wpdb;
     $ids = implode(',', $ids);
     $query = "\n      SELECT DISTINCT t.term_id, t.name, t.slug, t.term_group\n\n      FROM `wp_terms` as t\n      JOIN `wp_term_taxonomy` as tax ON t.term_id = tax.term_id\n      JOIN `wp_term_relationships` as rel ON tax.term_taxonomy_id = rel.term_taxonomy_id\n\n      WHERE rel.object_id IN ({$ids});\n    ";
     switch ($fields) {
         case 'raw':
             return get_results($query, OBJECT_K);
         case 'ids':
             return get_col($query);
         default:
             $results = get_results($query);
             foreach ($results as &$result) {
                 $result = self::get_controller($result);
             }
             return $results;
     }
 }
コード例 #9
0
echo GuiHelper::link('sini', 'logout.php');
?>

<form action='actions/do_log_answers.php' method='POST'>

<h3>Query:</h3>

<p><?php 
echo GuiHelper::textarea('query', $query);
?>
</p>

<p><?php 
echo GuiHelper::submit_button('try', 'try');
?>
 <?php 
echo GuiHelper::submit_button('save', 'save');
?>
 </p>

</form>

<?php 
get_results($query);
?>


</body>

</html>
コード例 #10
0
ファイル: bolt_map.php プロジェクト: Turante/boincweb
function show_unit_row($unit, $class, $level, $is_answer)
{
    global $breakdown, $breakdown_cat;
    global $rownum, $course_id;
    $a = $is_answer ? " (answer)" : "";
    $j = $rownum++ % 2;
    echo "<tr class=row{$j}>";
    if ($breakdown && $breakdown_cat) {
        echo "\n\t\t\t<td><br></td>\n\t\t\t<td><br></td>\n\t\t";
    } else {
        $c = class_name($class);
        echo "\n\t\t\t<td><b>" . spaces($level) . "{$unit->name}</b></td>\n\t\t\t<td>{$c} {$a}</td>\n\t\t";
    }
    if ($breakdown) {
        if ($breakdown_cat) {
            echo "<td>{$breakdown_cat}</td>\n";
        } else {
            echo "<td>Total</td>\n";
        }
    }
    switch ($class) {
        case "BoltLesson":
            $mode = BOLT_MODE_LESSON;
            $views = get_views($unit, $mode);
            $n = count($views);
            $out = outcomes($views);
            $t = avg_time($views);
            echo "<td>{$n}</td>";
            $n = get_nquestions($unit, $mode);
            if ($n) {
                echo "<td><a href=bolt_map.php?action=questions&course_id={$course_id}&name={$unit->name}&mode={$mode}" . filter_url() . ">{$n}</a></td>\n";
            } else {
                echo "<td>0</td>\n";
            }
            echo outcome_graph($out, 200);
            echo empty_cell();
            echo time_graph($t, 200);
            break;
        case "BoltExercise":
            $mode = $is_answer ? BOLT_MODE_ANSWER : BOLT_MODE_SHOW;
            $views = get_views($unit, $mode);
            $n = count($views);
            $out = outcomes($views);
            $t = avg_time($views);
            echo "<td>{$n}</td>";
            $n = get_nquestions($unit, $mode);
            if ($n) {
                echo "<td><a href=bolt_map.php?action=questions&course_id={$course_id}&name={$unit->name}&mode={$mode}>{$n}</a></td>\n";
            } else {
                echo "<td>0</td>\n";
            }
            echo outcome_graph($out, 200);
            if ($is_answer) {
                echo empty_cell();
            } else {
                $results = get_results($unit);
                $score = avg_score($results);
                echo score_graph($score, 200);
            }
            echo time_graph($t, 200);
            break;
        case "BoltExerciseSet":
            $xr = get_xset_results($unit);
            $n = count($xr);
            echo "<td>{$n}</td>";
            echo empty_cell();
            echo empty_cell();
            $score = avg_score($xr);
            echo score_graph($score, 200);
            echo empty_cell();
            break;
        default:
            echo empty_cell();
            echo empty_cell();
            echo empty_cell();
            echo empty_cell();
            echo empty_cell();
    }
    echo "</tr>\n";
}
コード例 #11
0
ファイル: registration.php プロジェクト: redcap3000/myparse
<?php
// for simple user registration

if(!$_POST['username']) echo ' <b>Please enter a username.</b><br>';
else{
		mysqli_query($mysqli_link,"select username from ".config::$_['table_prefix']." where username ='******'username'] . "';");
		if(mysqli_affected_rows($mysqli_link) > 0) echo '<b>'.$_POST['username'].' username exists, please select another.</b><br>';			
		elseif(!$_POST['pass'] || !$_POST['pass_confirm']) echo '<b>Please enter a password and confirmation</b><br>';
		elseif($_POST['pass'] != $_POST['pass_confirm']) echo '<b>Passwords do not match please re-enter and try again.</b><br>';
		elseif(!$_POST['email']) echo '<b>Please enter an email address.</b><br>';
		// defaults to userlevel 5
		else {
			get_results("INSERT INTO `".config::$_['table_prefix']."users` ( `username`, `full_name`, `password`, `usergroup`, `email`) VALUES ( '".$_POST['username']."', '".$_POST['fullname']."', '".md5($_POST['pass'])."', '5', '".$_POST['email']."');",1);
			echo '<h2> Thank you for registering!</h2>';
		
			}
		}
		// report sucess somewhere .... possibly send email out to user ? do a registration confirmation link to avoid abuse ?
 private function queryEntriesParent($entry_parent)
 {
     if ($this->queryEntriesParentQuery === null) {
         $this->queryEntriesParentQuery = $this->parentQuery;
         $this->queryEntriesParentQuery->appendCondition("`{$this->column_parent}` = '%d'");
         $this->queryEntriesParentQuery = $this->queryEntriesParentQuery->getQuery();
     }
     return get_results(sprintf($this->queryEntriesParentQuery, (int) $entry_parent), $this->className);
 }
コード例 #13
0
ファイル: test1.php プロジェクト: seelang2/ClassArchive
<?php

include "functions.php";
include "header.php";
if (!($dbh = db_connect('tc8401_classdb', 'tc8401_dbuser', 'simple'))) {
    exit('Error connecting to database.');
}
$query = "SELECT * FROM contact";
$result = get_results($query, 'A', true);
/*
echo "<div>";
print_results($result);
echo "</div>";
*/
echo "<div>" . print_results2($result, true) . "</div>";
/*
echo "<pre>" . print_r($result, true) . "</pre>";
reset ($result);
*/
include "footer.php";
コード例 #14
0
ファイル: viewsubs.php プロジェクト: seelang2/ClassArchive
        if (!$result) {
            echo "<p>There was a problem updating the database.<br />MySQL Error: " . mysql_error() . "</p>";
        } else {
            echo "<p>Subscription was added successfully.</p>";
        }
    }
}
$query = "SELECT subs.id, name FROM subs, c_to_s WHERE subs.id = s_id AND c_id = '{$_SESSION['id']}'";
if (!($result = get_results($query))) {
    echo "<p>No Subscriptions Found.</p>";
} else {
    echo "<h2>Available Subscriptions:</h2>";
    print_results1($result);
}
$query = "SELECT subs.id, name FROM subs WHERE NOT EXISTS (SELECT * FROM c_to_s WHERE subs.id = s_id AND c_id = '{$_SESSION['id']}')";
if (!($all_subs = get_results($query))) {
    echo "<p>No additional subscriptions are available.</p>";
} else {
    echo "<form action=\"{$me}?mode=add\" method=\"post\"><select name=\"subs\">";
    foreach ($all_subs as $row) {
        echo "<option value=\"{$row['id']}\">{$row['name']}</option>";
    }
    echo "</select> <input type=\"submit\" name=\"butSubmit\" value=\"Add\" /></form>";
}
?>




<?php 
include "footer.php";
コード例 #15
0
ファイル: main.php プロジェクト: laiello/cartonbank
    $search_keywords_filter = "";
}
// FINAL SQL
$sql = "SELECT `wp_product_list`.*, `wp_product_brands`.`name` as brand, `wp_product_brands`.`id` as brandid, `wp_product_categories`.`name` as kategoria, `wp_product_list`.`category` as category_id, `wp_product_files`.`width`, `wp_product_files`.`height` FROM `wp_product_list`, `wp_product_brands`, `wp_product_categories`,`wp_product_files` WHERE `wp_product_list`.`active`='1' " . $cartoonid_filter . $brandid_filter . $categoryid_filter . $exclude_category_sql . $colorfilter . $approved_or_not . $min_points_filter . " AND wp_product_files.id = wp_product_list.file AND `wp_product_list`.`visible`='1' " . $search_keywords_filter . " AND `wp_product_brands`.`id` = `wp_product_list`.`brand` AND `wp_product_list`.`category` = `wp_product_categories`.`id`  {$orderBy} LIMIT " . $offset . "," . $items_on_page;
// FINAL sql FOR ТЕМА ДНЯ
if ($category == '777') {
    $sql = "SELECT `wp_product_list`.*, `wp_product_brands`.`id` as brandid, `wp_product_brands`.`name` as brand, `wp_item_category_associations`.`category_id`, `wp_product_categories`.`name` as kategoria FROM `wp_product_list`,`wp_item_category_associations`, `wp_product_brands`, `wp_product_categories` WHERE `wp_product_list`.`id` = `wp_item_category_associations`.`product_id`  AND `wp_product_list`.`tema_dnya_approved` = '1'  AND `wp_product_brands`.`id` = `wp_product_list`.`brand` AND `wp_item_category_associations`.`category_id` = `wp_product_categories`.`id` AND  wp_product_list.id = (select id from tema_dnya where DATETIME = DATE( NOW( ) ) ) LIMIT 1 UNION SELECT `wp_product_list`.*, `wp_product_brands`.`id` as brandid, `wp_product_brands`.`name` as brand, `wp_item_category_associations`.`category_id`, `wp_product_categories`.`name` as kategoria FROM `wp_product_list`,`wp_item_category_associations`, `wp_product_brands`, `wp_product_categories` WHERE `wp_product_list`.`active`='1'  AND `wp_item_category_associations`.`category_id` != '666'  AND `wp_product_list`.`approved` = '1'  AND `wp_product_list`.`tema_dnya_approved` = '1'  AND `wp_product_list`.`visible`='1' AND `wp_product_list`.`id` = `wp_item_category_associations`.`product_id` AND `wp_product_brands`.`id` = `wp_product_list`.`brand` AND `wp_item_category_associations`.`category_id` = `wp_product_categories`.`id` AND `wp_item_category_associations`.`category_id`='777'  AND `wp_product_categories`.`id`=777 and wp_product_list.id not in (SELECT id FROM tema_dnya WHERE DATETIME = DATE( NOW( ) ) )";
}
// COUNT total number of images for this query
$sql_count_total = "SELECT COUNT(`wp_product_list`.id) as count FROM `wp_product_list`, `wp_product_brands`, `wp_product_categories` WHERE `wp_product_list`.`active`='1' " . $cartoonid_filter . $brandid_filter . $categoryid_filter . $exclude_category_sql . $colorfilter . $approved_or_not . " AND `wp_product_list`.`visible`='1' " . $search_keywords_filter . " AND `wp_product_brands`.`id` = `wp_product_list`.`brand` AND `wp_product_list`.`category` = `wp_product_categories`.`id`";
//todo $searchdonebutnothingfound???
if (!$searchdonebutnothingfound) {
    $count = get_results($sql_count_total);
    $totalitems = $count[0]['count'];
}
$rrr = get_results($sql);
$result = mysql_query($sql);
if (!$result) {
    die('Invalid query: ' . mysql_error());
}
$licontent = '';
while ($row = mysql_fetch_array($result)) {
    //dimensions
    $width = $row['width'];
    $height = $row['height'];
    $_size_warning = "";
    if ($width < 800 or $height < 800) {
        $_size_warning = "<div style='font-size:1em;'><a style='color:red;' href='" . SITEURL . "?page_id=771'>Внимание! Размеры файла<br />ограничивают применение!</a></div>";
    }
    $_size = $width . "px X " . $height . "px;";
    $_x_sm = round($width / 300 * 2.54, 1);
コード例 #16
0
function vote_request()
{
    try {
        $list1 = "LISTA ZA GRADSKO/OPĆINSKO VIJEĆE";
        $list11 = 35;
        //"LISTA ZA GRADSKO/OPĆINSKO VIJEĆE";
        $list2 = "ŽUPANIJSKA SKUPŠTINA";
        $list3 = "ZAMJENIK ŽUPANA IZ REDA N.M.";
        $list4 = "GRADSKA SKUPŠTINA GRADA ZAGREBA";
        scraperwiki::attach("liste");
        $query = 'zupanija from liste."područja" where grad_opcina="' . $_GET['city'] . '"';
        $county = scraperwiki::select($query);
        if ($county == null || $county[0]['zupanija'] != $_GET['county']) {
            $_GET['page'] = 'auth';
            return false;
        }
        $query = 'lista, izvor, kandidati from liste."' . $county[0]['zupanija'] . '" where grad_opcina="' . $_GET['city'] . '" or grad_opcina is null';
        $data = scraperwiki::select($query);
        $votes = array();
        for ($i = 0; $i < count($data); $i++) {
            $list = "";
            foreach ($data[$i] as $key => $value) {
                if ($key == "lista") {
                    $list = $value;
                } else {
                    if ($key == "izvor") {
                        continue;
                    } else {
                        if ($key == "kandidati") {
                            $list = trim($list);
                            $len = strlen($list);
                            if ($len == strlen($list1) || $len == $list11 || $len == strlen($list2) || $len == strlen($list4)) {
                                if (isset($_GET['lista' . $i])) {
                                    $vote = $_GET['lista' . $i];
                                    $l = substr($vote, 8);
                                    if (isset($_GET['lista' . $i . 'kandidat' . $l])) {
                                        $vote = $_GET['lista' . $i . 'kandidat' . $l];
                                        if ($vote != "") {
                                            $votes[$list] = $l . '.' . $vote;
                                        }
                                    }
                                }
                            } else {
                                $len = strlen($list);
                                if ($len == strlen($list3)) {
                                    if (!isset($_GET['manjina']) || $_GET['manjina'] == "") {
                                        continue;
                                    }
                                    $minor = strtolower($_GET['manjina']);
                                    $minor[strlen($minor) - 1] = 'e';
                                    if (strpos($value, $minor) == -1) {
                                        continue;
                                    }
                                }
                                if (isset($_GET['lista' . $i])) {
                                    $vote = $_GET['lista' . $i];
                                    $l = substr($vote, 8);
                                    if ($l != "") {
                                        $votes[$list] = $l;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (!isset($_GET['time'])) {
            $votes['BIRAČ'] = hash("sha512", $_GET['boi'] . $_GET['prezime'] . $_GET['oib'] . $_GET['ime'] . $_GET['mbg']);
        } else {
            $votes['BIRAČ'] = $_GET['time'];
        }
        $votes['GRAD'] = $_GET['city'];
        $votes['ŽUPANIJA'] = $_GET['county'];
        scraperwiki::save_sqlite(array('BIRAČ'), $votes);
        get_results();
        return true;
    } catch (Exception $e) {
        $_GET['page'] = 'auth';
        return false;
    }
}
コード例 #17
0
ファイル: yelp_api.php プロジェクト: slogan-tech/angularjs
/**
 * User input is handled here 
 */
$longopts = array("term::", "location::");
$options = getopt("", $longopts);
$term = $options['term'] ?: 'lunch';
$location = $options['location'] ?: '渋谷駅';
// query_api($term, $location);
//get_results($term, $location);
switch ($_SERVER['REQUEST_METHOD']) {
    case 'GET':
        if (isset($_GET['storeId'])) {
            $business = get_business(urlencode($_GET['storeId']));
            $business = json_decode($business);
            $ar = [];
            $ar[] = $business;
            echo json_encode($ar);
        } else {
            if (isset($_GET['place'])) {
                $location = $_GET['place'];
                echo get_results($term, $location);
            } else {
                echo get_results($term, $location);
            }
        }
        break;
    case 'POST':
        break;
    case 'DELETE':
        break;
}
コード例 #18
0
ファイル: functions.php プロジェクト: CharlieHD/U-232-V3
function build_result($array, $pager)
{
    //define some vars
    $result = $array['search']['results']['subtitle'];
    $base = get_base($array['search']['base']);
    $time = get_results($array['search']['results']);
    //print the content
    if (count($result) == 0) {
        print "<div align=\"center\"><h2>No result found</h2></div>";
    } else {
        ?>
			<table width="55%" style="border-collapse:collapse;" border="1" cellspacing="0" cellpadding="5">
			  <tr>
				<td colspan="9" align="right">Search took&nbsp;<font class="releasename">
				  <?php 
        echo $time["searchtime"];
        ?>
				  s</font>, Items found <font class="releasename">
				  <?php 
        echo $time["itemsfound"];
        ?>
				  </font></td>
			  </tr>
			  <tr>
				<td align="left" colspan="4" width="100%">Movie name</td>
				<td nowrap="nowrap" align="center">Added</td>
				<td nowrap="nowrap" align="center"><img src="imgs/icon-files.gif" width="12" height="12" alt=" " title="CDs" /></td>
				<td nowrap="nowrap" align="center"><img src="imgs/icon-format.gif" width="12" height="13" alt=" " title="Format" /></td>
				<td nowrap="nowrap" align="center"><img src="imgs/icon-upper.gif" width="15" height="17" alt=" " title="Uploader" /></td>
			  </tr>
			  <?php 
        $count = $time["itemsfound"] == 1 ? 1 : count($result);
        for ($i = 0; $i < $count; $i++) {
            $movie = $count == 1 ? get_details($result) : get_details($result[$i]);
            ?>
			  <tr>
				<td align="center" nowrap="nowrap"><img src="flag/<?php 
            echo $movie["iso639"];
            ?>
.gif" width="18" height="12" border="0" alt="<?php 
            echo $movie["language"];
            ?>
" title="<?php 
            echo $movie["language"];
            ?>
" /></td>
				<td align="left" colspan="2" width="100%"><a href="<?php 
            echo $base . $movie["detail"];
            ?>
" target="_blank">
				  <?php 
            echo $movie["movie"];
            ?>
				  </a>
				  <?php 
            echo $movie["releasename"] ? "<br/><font class=\"releasename\">" . $movie["releasename"] . "</font>" : "";
            ?>
				  </td>
				<td nowrap="nowrap" align="center"><a href="<?php 
            echo $base . $movie["download"];
            ?>
" target="blank"><img src="imgs/icon-download.gif" width="12" height="12" border="0" alt=" " title="download" /></a></td>
				<td nowrap="nowrap" align="center"><?php 
            echo str_replace(" ", "<br/>", $movie["subadddate"]);
            ?>
</td>
				<td nowrap="nowrap" align="center"><?php 
            echo $movie["files"];
            ?>
</td>
				<td nowrap="nowrap" align="center"><?php 
            echo $movie["format"];
            ?>
</td>
				<td nowrap="nowrap" align="center"><?php 
            echo $movie["user"] == "" ? "Unknown" : $movie["user"];
            ?>
</td>
			  </tr>
			  <?php 
        }
        ?>
			</table>
				<?php 
        echo $time["itemsfound"] > 40 ? "<br/><div align=\"center\">" . pager($time["itemsfound"], $pager) . "</div>" : "";
        ?>
			<?php 
    }
}
コード例 #19
0
                    break;
                }
            }
            fclose($fp);
            if ($count >= RESULT_LIMIT) {
                break;
            }
        }
    }
    return $return;
}
if (!empty($_POST) && !empty($_POST['q'])) {
    set_time_limit(0);
    //不限定脚本执行时间
    $q = strip_tags(trim($_POST['q']));
    $results = get_results($q);
    $count = count($results);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>郴州高职院学生查询</title>
<link rel="stylesheet" type="text/css" href="css/default.css" />
    <style type="text/css">
    body,td,th{
    color: #FFF;
}
    a:link{
    color: #0C0;
コード例 #20
0
ファイル: ar_results.php プロジェクト: inikoo/fact
 About:
 Autor: Raul Perusquia <*****@*****.**>
 Created: 23 September 2014 16:10:50 BST, Nottingham, UK
*/
require_once 'common.php';
require_once 'ar_common.php';
if (!isset($_REQUEST['tipo'])) {
    $response = array('state' => 405, 'msg' => 'Non acceptable request (t)');
    echo json_encode($response);
    exit;
}
$tipo = $_REQUEST['tipo'];
switch ($tipo) {
    case 'get_results':
        $data = prepare_values($_REQUEST, array('fork_key' => array('type' => 'key')));
        get_results($data);
        break;
    case 'list_results':
        $data = prepare_values($_REQUEST, array('fork_key' => array('type' => 'key'), 'callback' => array('type' => 'string')));
        list_results($data);
        break;
    default:
        $response = array('state' => 404, 'msg' => 'Operation not found');
        echo json_encode($response);
}
function list_results($data)
{
    global $mysqli;
    $fork_key = $data['fork_key'];
    $sql = sprintf("select * from `Result Dimension` where `Fork Key`=%d", $fork_key);
    $res = $mysqli->query($sql);
コード例 #21
0
ファイル: wp_api.php プロジェクト: redcap3000/Wordscript
                                    $attachment_pro = get_at_pro_index($meta_field->meta_key);
                                    $action[$loc]->meta['_attachments_pro'][$attachment_pro[1]][$attachment_pro[0]] = utf8_encode($meta_field->meta_value);
                                    unset($attachment_pro);
                                    // if the end of the meta_key is numeric, then its an attachments pro key.. this could bite me later..
                                    // step one filter the string to only show numeric
                                } else {
                                    $action[$loc]->meta[$meta_field->meta_key] = utf8_encode($meta_field->meta_value);
                                }
                            }
                            if ($tags) {
                                $action[$loc]->tags = clean_result($tags, 'tag');
                            }
                        }
                    }
                }
            } elseif ($action = get_results($query) && $directive[0] == 'categories') {
                $action = clean_result($action, 'slug');
            }
            if (isset($_GET['stats'])) {
                $action['stats'] = sprintf("%.4f", (double) array_sum(explode(' ', microtime())) - $start_time) * 1000 . "ms,  using " . round(memory_get_usage() / 1024) . " k  / and {$queries} queries ";
            }
            header('Content-type: application/json; charset=utf-8', true, 200);
            echo isset($_GET['embed']) ? 'var wp_api=' . json_encode($action) . ';' : json_encode($action);
        }
    }
}
function get_at_pro_index($string, $counter = 0)
{
    // this is finished when it returns an array with the 'index' and the 'fieldname' for the key value
    // give string .. could reduce this to a single tenery operator..
    if ($sub_string = substr($string, -1) && is_numeric($sub_string)) {
コード例 #22
0
ファイル: index.php プロジェクト: kmklr72/lmms.io
function process_params()
{
    $post_funcs = explode(',', POST_FUNCS);
    foreach ($post_funcs as $func) {
        if (!GET_EMPTY($func)) {
            // Process parametrized functions
            switch ($func) {
                case 'rate':
                    update_rating(GET('file'), GET('rate'), SESSION());
                    break;
                    // break for file/rate, return for all others
                // break for file/rate, return for all others
                case 'search':
                    //move down
                //move down
                case 'q':
                    get_results(GET('category'), GET('subcategory'), GET('sort'), GET('q', GET('search', '')), '', GET('order'), GET('commentsearch'));
                    return;
                    // default: // do nothing
            }
            // Process built-in functions
            switch ($func . ":" . GET($func)) {
                case 'comment:add':
                    require "./comment_file.php";
                    return;
                case 'content:add':
                    require "./add_file.php";
                    return;
                case 'content:update':
                    require "./edit_file.php";
                    return;
                case 'content:delete':
                    require "./delete_file.php";
                    return;
                case 'account:settings':
                    require "./user_settings.php";
                    return;
                case 'action:show':
                    show_file(GET("file"), SESSION());
                    return;
                case 'action:register':
                    require "./register.php";
                    return;
                case 'action:browse':
                    // Browsing by category seems is currently only supported "browse" option
                    if (!GET_EMPTY('category')) {
                        get_results(GET('category'), GET('subcategory'), GET('sort'), '', '', GET('order'));
                        return;
                    } else {
                        if (!GET_EMPTY('user')) {
                            get_results(GET('category'), GET('subcategory'), GET('sort'), '', GET('user'), GET('order'));
                            return;
                        }
                    }
                    // default: // do nothing
            }
        }
    }
    // All else fails, show the "Latest Uploads" page
    get_latest();
}
コード例 #23
0
ファイル: dbg-wizard.php プロジェクト: usrg1983/yii2build
				<li> and you can always ask us a question using <a class="headline-link" href="http://shop.nusphere.com/contact_us/index.php "> NuSphere Contact Us Form</a></li>
			</ul>
		</div>

		<!-- Begin System INFO -->
		<div class="text_desc">
			<h1> What did I find out about your system </h1>
			<p>
				I assume that you placed me in the root directory of your web server
				and on your PhpED machine pointed your browser to me - like this: <i>&lt;URL of your web site&gt;</i>/dbg-wizard.php
			</p>
			<p>
			I see that:
			<ul class="plain">
				<?php 
get_results($rslt, $notices, $env, $dbg_instructions, $proj_settings);
foreach ($rslt as $value) {
    $cap = $value['caption'];
    echo "<li>{$cap}&nbsp;&nbsp;" . print_value($value) . "</li>\n";
}
?>
			</ul>
			<?php 
$i = 1;
foreach ($notices as $value) {
    echo "<font color='red'><strong>{$i}.&nbsp;</strong>{$value}</font><br>\n";
    $i++;
}
if ($env['platform_errmsg']) {
    echo "<font color='red'><strong>{$i}.&nbsp;</strong>{$env['platform_errmsg']}</font><br>\n";
    echo "Please consult with <a href='http://www.nusphere.com/products/debugging_php.htm'>this table</a> regarding supported platforms.";
コード例 #24
0
ファイル: data.php プロジェクト: sumudinie/hubzero-cms
 /**
  * Get data as CSV file
  *
  * @param      string  	$db_name
  * @param      integer  	$version
  *
  * @return     string data
  */
 public function getCsvData($db_name = '', $version = '', $tmpFile = '')
 {
     if (!$db_name || !$version) {
         return false;
     }
     mb_internal_encoding('UTF-8');
     // component path for "com_dataviewer"
     $dv_com_path = PATH_CORE . DS . 'components' . DS . 'com_dataviewer';
     require_once $dv_com_path . DS . 'dv_config.php';
     require_once $dv_com_path . DS . 'lib' . DS . 'db.php';
     require_once $dv_com_path . DS . 'modes' . DS . 'mode_dsl.php';
     require_once $dv_com_path . DS . 'filter' . DS . 'csv.php';
     $dv_conf = get_conf(NULL);
     $dd = get_dd(NULL, $db_name, $version);
     $dd['serverside'] = false;
     $sql = query_gen($dd);
     $result = get_results($sql, $dd);
     ob_start();
     filter($result, $dd, true);
     $csv = ob_get_contents();
     ob_end_clean();
     if ($csv && $tmpFile) {
         $handle = fopen($tmpFile, 'w');
         fwrite($handle, $csv);
         fclose($handle);
         return true;
     }
     return $csv;
 }
コード例 #25
0
    $cmds = array("CMD" => "Put", "PROGRAM" => "blastn", "DATABASE" => "nr", "QUERY" => $gi);
    $html = post('http://www.ncbi.nlm.nih.gov/blast/Blast.cgi', $cmds);
    //echo $html;
    $rid = '';
    $rtoe = 0;
    if (preg_match('/^    RID = (?<rid>.*)$/m', $html, $m)) {
        $rid = $m['rid'];
    }
    if (preg_match('/^    RTOE = (?<rtoe>.*)$/m', $html, $m)) {
        $rtoe = (int) $m['rtoe'];
    }
    if ($rid != '') {
        echo "Request RID={$rid}\n";
        echo "Estimated time to completion={$rtoe}\n";
        sleep($rtoe);
        $xml = get_results($rid);
        file_put_contents('tmp/' . $rid . '.xml', $xml);
        echo $xml;
        // Convert GBIF XML to Javascript for Google Maps
        $xp = new XsltProcessor();
        $xsl = new DomDocument();
        $xsl->load('blast2fasta.xsl');
        $xp->importStylesheet($xsl);
        $dom = new DOMDocument();
        $dom->loadXML($xml);
        $xpath = new DOMXPath($dom);
        $fasta = $xp->transformToXML($dom);
        echo $fasta;
        file_put_contents('tmp/' . $rid . '.fas', $fasta);
    }
}
コード例 #26
0
function view($dd = false)
{
    global $com_name, $html_path, $dv_conf;
    $name = $dd['dv_id'];
    $document = App::get('document');
    dv_add_script('util.js');
    /* jQuery */
    dv_add_script('jquery.js');
    /* Bootstrap */
    dv_add_script('bootstrap/bootstrap.js');
    dv_add_css('bootstrap/css/bootstrap.css');
    /* jQuery-UI */
    dv_add_script('jquery-ui/jquery-ui.min.js');
    dv_add_css('jquery-ui/smoothness/jquery-ui.min.css');
    dv_add_css('font-awesome/css/font-awesome.css');
    dv_add_script('excanvas.js');
    dv_add_script('jquery-datatables/jquery.dataTables.min.js');
    dv_add_css('jquery-datatables/css/jquery.dataTables_themeroller.css');
    dv_add_css('jquery-datatables/css/jquery.dataTables_dv.css');
    dv_add_script('datatables.plugins.js');
    dv_add_script('jqplot/jquery.jqplot.min.js');
    dv_add_script('jqplot/plugins.dev');
    dv_add_css('jqplot/jquery.jqplot.css');
    dv_add_script('spreadsheet.js');
    dv_add_css('spreadsheet.css');
    dv_add_script('dv-spreadsheet-charts.js');
    dv_add_script('dv-spreadsheet-charts-dl.js');
    dv_add_script('dv_custom_views.js');
    dv_add_css('dv_custom_views.css');
    dv_add_script('jquery.lazyload.min.js');
    if (isset($dd['show_maps'])) {
        dv_add_script('/leaflet/leaflet.js');
        dv_add_css('/leaflet/leaflet.css');
        dv_add_script('dv_maps.js');
    }
    dv_add_script('jquery.dv.js');
    $dv_conf['settings']['view']['id'] = $dd['dv_id'];
    $dv_conf['settings']['view']['type'] = 'spreadsheet';
    $dv_conf['settings']['data_url'] = "index.php?option=com_{$com_name}&task=data&db=" . $dd['db_id']['id'] . '&dv=' . $dd['dv_id'];
    $dv_conf['settings']['view_url'] = "/dataviewer/view/{$dd['db_id']['id']}/{$dd['dv_id']}/";
    // Get the list of IDs if any
    $rec_ids = Request::getVar('id', '');
    if ($rec_ids != '') {
        $dv_conf['settings']['data_url'] .= '&id=' . htmlentities($rec_ids);
        $dv_conf['settings']['view_url'] .= '?id=' . htmlentities($rec_ids);
    } else {
        $dv_conf['settings']['view_url'] .= '?dv_first=1';
    }
    // Version
    $version = isset($dd['version']) ? "&v={$dd['version']}" : '';
    $dv_conf['settings']['data_url'] .= $version;
    $dv_conf['settings']['view_url'] .= $version;
    if ($dd) {
        $dv_conf['settings']['show_filter_options'] = isset($dd['filter_options']) ? $dd['filter_options'] : true;
        $custom_field_url = '';
        $custom_field = Request::getVar('custom_field', false);
        if ($custom_field) {
            $custom_field_url = '&custom_field=' . $custom_field;
        }
        // Custom views
        $custom_view = Request::getVar('custom_view', false);
        $custom_view_url = '';
        if ($custom_field) {
            $custom_view_url = '&custom_view=' . $custom_field;
        }
        // overrides
        $dv_conf['settings']['limit'] = isset($dd['display_limit']) ? $dd['display_limit'] : $dv_conf['settings']['limit'];
        $dv_conf['settings']['hide_data'] = isset($dd['hide_data']);
        $dv_conf['settings']['serverside'] = isset($dd['serverside']) && $dd['serverside'] ? true : false;
        if (!isset($dd['customizer']) && isset($dv_conf['customizer'])) {
            $dd['customizer'] = $dv_conf['customizer'];
        }
        if (isset($dd['customizer']) && $dd['customizer'] === false) {
            unset($dd['customizer']);
        }
        $dv_conf['settings']['serverside'] = isset($dd['serverside']) && $dd['serverside'] ? true : false;
        $sql = query_gen($dd);
        $res = get_results($sql, $dd);
        // Customizer View
        $hide_str = '';
        $group_by = '';
        $show_customizer = true;
        if (isset($dd['customizer'])) {
            if (isset($dd['customizer']['show_table']) && !$dd['customizer']['show_table']) {
                $hide_str = 'display: none;';
            }
            if (isset($dd['customizer']['show_customizer']) && !$dd['customizer']['show_customizer']) {
                $show_customizer = false;
            }
            if (isset($dd['group_by'])) {
                $arr = explode(',', $dd['group_by']);
                foreach ($arr as $a) {
                    $a = trim($a);
                    $lbl = isset($dd['cols'][$a]['label']) ? $dd['cols'][$a]['label'] : $a;
                    $group_by .= '<div class="dv_customizer_group_by_item_div" style="padding: 3px; margin: 5px; border: 1px #EEE solid;"><input type="checkbox" checked="checked" class="dv_customizer_group_by_item" value="' . $a . '" /> &nbsp;<label style="cursor: pointer;">' . str_replace('<br />', ' ', $lbl) . '</label></div>';
                }
            }
        }
        $f_data = filter($res, $dd);
        $d_arr = json_decode($f_data, true);
        if (isset($dd['show_maps'])) {
            $document->addScript('//maps.google.com/maps/api/js?sensor=false');
        }
        $help_file = false;
        if (isset($dv_conf['help_file_base_path'])) {
            $help_file = $dv_conf['help_file_base_path'] . $name . '/' . $name . '-help.html';
            if (!file_exists(JPATH_BASE . $help_file)) {
                $help_file = false;
            }
        }
        $return = '';
        if (isset($dd['return']) && isset($dd['return']['raw'])) {
            $return = $dd['return']['raw'];
        } elseif (isset($dd['return'])) {
            $return = '<span id="dv_return_link" style="font-size: 1.1em; margin-left: 10px; padding-top: 12px;"><a href="' . $dd['return']['url'] . '"><strong>' . $dd['return']['label'] . '</strong></a></span>';
        }
        // Filtered Views
        $filter = Request::getVar('filter', false);
        $filted_view = array();
        $filted_view_str = '';
        if ($filter !== false) {
            $dv_conf['settings']['data_url'] .= '&filter=' . $filter;
            $dv_conf['settings']['filters']['fv_vals'] = $filter;
            $ff = explode('||', $filter);
            foreach ($ff as $f) {
                $f = explode('|', $f);
                $filted_view[$f[0]] = $f[1];
            }
        }
        ?>
	<a name="dv_top"></a>
	<div id="dv-spreadsheet">

	<?php 
        if (!Request::getVar('show_table_only', false)) {
            ?>

		<div id="dv_title" style="margin: 0;">
			<h2 class="ui-corner-all" style="display: inline-block;">
				<i class="icon-table"></i>
				<?php 
            print $dd['title'];
            ?>
			</h2>
			&nbsp;<h4 id="dv_return_link_container" style="display: inline-block; margin: 0;"><?php 
            print $return;
            ?>
</h4>
		</div>
		<div id="dv-spreadsheet-toolbar" class="ui-corner-top">
			<?php 
            if (!isset($dd['top_menu']['download']['show']) || $dd['top_menu']['download']['show'] != false) {
                ?>
			<button class="btn btn-mini dv-btn-download" data-format="csv" title="Download Data as a spreadsheet">
				<i class="icon-download"> </i >
				<span class="lbl">Download</span>
			</button>
			<?php 
            }
            ?>

			<?php 
            if (!isset($dd['top_menu']['fullscreen']['show']) || $dd['top_menu']['fullscreen']['show'] != false) {
                ?>
			<button id="dv-btn-fullscreen" class="btn btn-mini" title="Fullscreen" data-screen-mode=''>
				<i class="icon-fullscreen"> </i >
				<span class="lbl">Fullscreen</span>
			</button>
			<?php 
            }
            ?>

			<?php 
            if (isset($dd['filters']) && count($dd['filters']) > 0) {
                ?>
			<button id="dv-btn-filters" class="btn btn-mini" title="Filter Dialog">
				<i class="icon-filter"> </i >
				<span class="lbl">Filter Dialog</span>
			</button>
			<?php 
            }
            ?>

			<button id="dv-btn-filter-clear-all" class="btn btn-mini" title="Click this to clear all the column filters and the global search">
				<i class="icon-remove-circle"> </i >
				<span class="lbl">Clear Filters</span>
			</button>

			<?php 
            if (!isset($dd['top_menu']['no_wrap']['show']) || $dd['top_menu']['no_wrap']['show'] != false) {
                ?>
			<button id="dv-btn-no-wrap" class="btn btn-mini" title="Disable text wrapping for all cells." data-current="normal">
				<i class="icon-text-width"> </i >
				<span class="lbl">No-Wrap</span>
			</button>
			<?php 
            }
            ?>

			<?php 
            if (isset($dd['custom_charts']) || isset($dd['charts_list'])) {
                ?>
			<button id="dv-spreadsheet-charts" class="btn btn-mini" title="Display charts">
				<i class="icon-bar-chart"> </i >
				<span class="lbl">Charts</span>
			</button>
			<?php 
            }
            ?>

			<?php 
            if (isset($dd['show_maps'])) {
                ?>
			<button id="dv-spreadsheet-maps" class="btn btn-mini" title="Display Maps">
				<i class="icon-map-marker"></i >
				<span class="lbl">Maps</span>
			</button>
			<?php 
            }
            ?>

			<?php 
            if (isset($dd['customizer'])) {
                ?>
			<button id="dv-customizer-btn" class="btn btn-mini" title="Enables users to select a sub-set of columns to view.">
				<i class="icon-edit"> </i >
				<span class="lbl">Customize DataView</span>
			</button>
			<?php 
            }
            ?>
		</div>

		<div style="display: none;">
			<span id="dv_top_toolbar" class="ui-corner-top" style="padding: 3px 5px 3px 3px; margin: 0; border-style: inset; border-bottom-width: 0px;">
				<?php 
            if ($help_file) {
                ?>
				<button id="dv_show_help">Help</button>
				<?php 
            }
            ?>
				<?php 
            if (isset($dd['show_maps'])) {
                ?>
				<input type="checkbox" id="dv_maps" class="dv_panel_btn" /><label for="dv_maps">Map</label>
				<?php 
            }
            ?>
				<?php 
            if (isset($dd['customizer']) && $show_customizer) {
                ?>
				<input type="checkbox" id="" class="dv_panel_btn" /><label for="dv-customizer-btn"></label>
				<?php 
            } elseif (isset($dd['customizer'])) {
                ?>
				<input type="checkbox" id="dv-customizer-btn" class="dv_panel_btn" /><label for="dv-customizer-btn">Customize View</label>
				<?php 
            }
            ?>
			</span>
		</div>

		<?php 
            if (isset($dd['custom_charts']) || isset($dd['charts_list'])) {
                ?>
		<div id="dv_charts_panel" style="display: none; clear: both; width: 860px; height: 380px; padding: 5px 10px 10px 5px; margin-top: 0; border: 1px solid #DDD; background: #EEE;" class="ui-corner-bottom dv_top_pannel">
			<button id="dv_pdcharts_download_btn" class="btn btn-mini btn-success" title="Download chart as an image"  style="float: right; z-index: 1; margin: 3px;">
				<i class="icon-download"> </i >
				<span class="lbl">Download Chart</span>
			</button>
			<button id="dv_pdcharts_draw_btn" class="btn btn-mini btn-info" title="Reload charts" style="float: right; z-index: 1; margin: 3px;">
				<i class="icon-repeat"> </i >
				<span class="lbl">Reload</span>
			</button>

			<div style="float:left; height: 380px; width: 245px;">
				<div id="dv_charts_control_panel" style="padding: 0 5px; ">
				<?php 
                if (isset($dd['charts_list'])) {
                    ?>
				<select id="dv_chart_name" style="width: 100%;">
					<?php 
                    $pd_id = 0;
                    foreach ($dd['charts_list'] as $cl) {
                        ?>
					<option value="<?php 
                        print $pd_id;
                        ?>
"><?php 
                        print $cl['title'];
                        ?>
</option>
					<?php 
                        $pd_id++;
                    }
                    ?>
				</select>

				<div id="dv_chart_desc" class=" ui-widget-content ui-corner-all" style="margin-top: 10px; font-size: 0.9em; border-style: inset; padding: 2px; overflow: auto; height: 340px;"></div>
				<?php 
                }
                ?>
				</div>
			</div>
			<div id="dv_charts_preview_chart" style="height:100%; width:auto; margin-left: 248px;" class="ui-widget-content ui-corner-all">
			</div>
		</div>
		<?php 
            }
            ?>

		<?php 
            if (isset($dd['show_maps'])) {
                ?>
		<div id="dv_maps_panel" style="position: relative; display: none; clear: both; width: 800px; height: 300px; padding: 3px 5px 3px 5px; margin-top: 0;" class="ui-widget ui-widget-header ui-corner-bottom dv_top_pannel">
			<button class="btn btn-inverse btn-mini" title="Click here to reload the map" id="dv_map_reload" style="float: left;">
				<i class="icon-refresh"></i > Reload Map
			</button>
			<div style="float: right;">
				<button data-format="kml" class="btn btn-inverse btn-mini dv-btn-download" style="background: #FAA732; background-image: linear-gradient(to bottom, #FBB450, #F89406); background-repeat: repeat-x;" title="Export location data in KML format">
					<i class="icon-download"></i > KML
				</button>
				<button data-format="kmz" class="btn btn-inverse btn-mini dv-btn-download" style="background: #FAA732; background-image: linear-gradient(to bottom, #FBB450, #F89406); background-repeat: repeat-x;" title="Export location data in KMZ format">
					<i class="icon-download"></i > KMZ
				</button>
				<button data-format="shp" class="btn btn-inverse btn-mini dv-btn-download" style="background: #FAA732; background-image: linear-gradient(to bottom, #FBB450, #F89406); background-repeat: repeat-x;" title="Export location data in SHP format">
					<i class="icon-download"></i > SHP
				</button>
			</div>
			<div id="dv_maps_canvas" style="position: absolute; top: 30px; bottom: 8px; left: 5px; right: 8px;" class="ui-widget-content ui-corner-all"></div>
		</div>
		<?php 
            }
            ?>

		<?php 
            if (isset($dd['customizer'])) {
                ?>
		<?php 
                $full_list = '';
                $selected = '';
                foreach ($dd['cols'] as $id => $prop) {
                    if (!isset($prop['hide']) || isset($prop['hide']) && $prop['hide'] != 'hide') {
                        if (!isset($prop['label'])) {
                            $prop['label'] = $id;
                        }
                        $col_label = str_replace('<br />', ' ', $prop['label']);
                        $col_label = str_replace('<hr />', '&nbsp/&nbsp', $col_label);
                        if (isset($prop['units']) && $prop['units'] != '') {
                            $col_label = $col_label . ' <small>[' . $prop['units'] . ']</small>';
                        } elseif (isset($prop['unit']) && $prop['unit'] != '') {
                            $col_label = $col_label . ' <small>[' . $prop['unit'] . ']</small>';
                        }
                        if (isset($dd['customizer']['selected']) && in_array($id, $dd['customizer']['selected'])) {
                            $first_col = true;
                            $selected .= '<li data-dv-id="' . $id . '">' . $col_label . '</li>';
                        } else {
                            $full_list .= '<li data-dv-id="' . $id . '">' . $col_label . '</li>';
                        }
                    }
                }
                ?>
		<div id="dv_customizer_panel" style="display: none; clear: both;  padding: 5px 10px 10px 5px; margin-top: 0;" class="ui-widget ui-widget-header ui-corner-bottom dv_top_pannel">
			<div id="dv_customizer_content" style="height:100%; width:auto;" class="ui-widget-content ui-corner-all">
				<div id="dv_customizer_group_by" title="Customizer Group Rows" style="display: none; width: 500px; height: 350px;">
					<p>You can use this option to group rows of the views by certain fields to reduce duplicate rows</p>
					<div id="dv_customizer_group_by_list"><?php 
                print $group_by;
                ?>
</div>
				</div>
				<p id="dv_customizer_title_container" style="padding-left: 10px;">
					New Title: <input id="dv_customizer_view_title" value="<?php 
                print $dd['title'];
                ?>
" type="text" style="width: 550px;" />
					&nbsp;&nbsp;
					<input id="dv_customizer_group_by_btn" data-view-url="<?php 
                print $dv_conf['settings']['view_url'];
                ?>
" value="Group By [Reduce Duplicates]" type="button" style="display: none; padding: 2px;" />
					&nbsp;&nbsp;
					<input id="dv_customizer_launch_view_btn" data-view-url="<?php 
                print $dv_conf['settings']['view_url'];
                ?>
" value="Launch Custom View" type="button" style="display: none; padding: 2px;" />
				</p>
				<table border="0">
					<tr id="dv_customizer_lists_top">
						<td style="width: 400px;">Full Columns List</td>
						<td style="width: 400px;">Custom List</td>
					</tr>
					<tr>
						<td>
							<div class="dv_customizer_lists" style="overflow: auto;">
							<ul id="dv_customizer_full_list" class="dv_customizer_col_lists">
								<?php 
                print $full_list;
                ?>
							</ul>
							</div>
						</td>

						<td>
							<div class="dv_customizer_lists" style="overflow: auto;">
							<ul id="dv_customizer_selected" class="dv_customizer_col_lists">
								<?php 
                print $selected;
                ?>
							</ul>
							</div>
						</td>
					</tr>
				</table>

			</div>
		</div>
		<?php 
            }
            ?>

		<div id="more_information" style="display: none; min-width: 300px;"></div>
		<?php 
            if ($help_file) {
                ?>
		<div id="dv_help_dialog" style="display: none;">
			<iframe src="<?php 
                print $help_file;
                ?>
" id="modalIframeId" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto" title="Help">IFRAMES not supported by the browser</iframe>
			</div>
		</div>
		<?php 
            }
            ?>


	<?php 
        }
        //Table Only
        ?>


		<div id="dv-spreadsheet-container" style="margin: 0px; padding; 0px; <?php 
        print $hide_str;
        ?>
">
		<table id="dv-spreadsheet-tbl" style="margin-top: 0;">
	<?php 
        print '<thead></thead><tfoot><tr>';
        $colid = 0;
        foreach ($dd['cols'] as $id => $conf) {
            if (!isset($conf['hide'])) {
                $label = isset($conf['label']) ? $conf['label'] : $id;
                $label = str_replace('<br />', ' ', $label);
                $label = html_entity_decode(strip_tags($label), ENT_QUOTES, 'UTF-8');
                $title = '';
                $filter_msg = '';
                if ($dv_conf['settings']['serverside']) {
                    $filter_msg = "  \n\nThe dropdown list only shows a limited number of available options.  \n\nIf you don't see what you want on the list, please enter a filter text in the text box and then press Enter to bring up more results to match your text.";
                } else {
                    $filter_msg = "\t\n\nClick on the search box to list all the entries in the column";
                }
                if (isset($conf['filter_hint'])) {
                    $filter_hint = $conf['filter_hint'];
                } else {
                    if ($d_arr['field_types'][$id] == 'number' || $d_arr['field_types'][$id] == 'numrange') {
                        $filter_hint = "Enter a number to filter this column by.";
                        $filter_hint .= "  \n\nFollowing filter options are also supported,";
                        $filter_hint .= "\t\nRange filtering - ( e.g. 15.7 to 25 )";
                        $filter_hint .= "\t\nLess than, greater than ( e.g. <100 ), (e.g. >25)";
                        $filter_hint .= "\t\nLess than or equal, greater than or equal ( e.g. <=-12.5 ), (e.g. >=0.3)";
                        $filter_hint .= "\t\nEqual, not equal and ignore pattern ( e.g. =-2.55 ), ( e.g. !=-2.55 ), ( e.g. !55 )";
                    } elseif ($d_arr['field_types'][$id] == 'datetime') {
                        $filter_hint = "Enter a date to filter this column by.";
                        $filter_hint .= "\t\nRange filtering - ( e.g. 2011-01-25 to 2011-03-25 )";
                        $filter_hint .= "\t\nLess than, greater than ( e.g. <2011-03-25 ), (e.g. >2011-01-25)";
                        $filter_hint .= "\t\nLess than or equal, greater than or equal ( e.g. <=2011-03-25 ), (e.g. >=2010-03-25)";
                        $filter_hint .= "\t\nEqual, not equal and ignore pattern ( e.g. =2009-01-17 ), ( e.g. !=2009-01-17 ), ( e.g. !2009-01 )";
                    } else {
                        $filter_hint = "Enter a word or a phrase to filter this column by.";
                        $filter_hint .= "  \n\nFollowing filter options are also supported,";
                        $filter_hint .= "\t\nExact matches, use '=' ( e.g. =keyword)";
                        $filter_hint .= "\t\nTo ignore a specific word, use '!=' ( e.g. !=keyword)";
                        $filter_hint .= "\t\nTo ignore a pattern, use '!' ( e.g. !keyword )";
                    }
                }
                $title = $filter_hint . $filter_msg;
                if (isset($conf['type']) && $conf['type'] == 'image') {
                    print '<th><input title="' . $title . '" type="text" placeholder="' . $label . '" disabled=disabled /></th>';
                } elseif (isset($filted_view[$id])) {
                    print '<th><input type="text" placeholder="' . $filted_view[$id] . '" disabled=disabled style="background: yellow;" /></th>';
                } else {
                    print '<th><input title="' . $title . '" type="text" placeholder="' . $label . '" class="search_init" style="background: #FFF;" /><span class="dv-col-clear-filter" style="margin-left: -15px; color: #FFF; cursor: pointer;"><i class="icon-remove-sign"></i></span></th>';
                }
            }
            $colid++;
        }
        print '</tr></tfoot>';
        ?>
		</table>
		</div>
	<?php 
        // Filter dialog show/hide parameter
        $dv_show_filters = 'false';
        $path = explode('/', Request::path());
        if (isset($path[5]) && $path[5] == 'filter_dialog') {
            $dv_show_filters = 'true';
        }
        //Legacy support
        if (Request::getVar('show_filters', 'false') === 'true') {
            $dv_show_filters = 'true';
        }
        ?>
		<!-- Start: Dialog boxes -->
		<div id="truncated_text_dialog" style="display: none; overflow: auto;" title="Full Text"></div>

		<div id="dv_filters_dialog" title="<?php 
        print $dd['title'];
        ?>
 : Filters">
			<div id="dv_filters_tabs">
				<ul></ul>
			</div>
		</div>
		<!-- End: Dialog boxes -->

		<script>
			dv_data = <?php 
        print $f_data;
        ?>
;
			dv_settings = <?php 
        print json_encode($dv_conf['settings']);
        ?>
;
			dv_show_filters = <?php 
        print $dv_show_filters;
        ?>
;
			dv_settings.show_charts = <?php 
        print Request::getInt('show_chart', 'undefined');
        ?>
;
			dv_show_customizer = <?php 
        print $show_customizer ? 'true' : 'false';
        ?>
;
			var dv_show_maps = <?php 
        print Request::getString('show_map', 'undefined');
        ?>
;
		</script>

		<form style="display: none;" id="dv-spreadsheet-dl" method="POST"
			action="<?php 
        print $dv_conf['settings']['data_url'];
        ?>
&nolimit=true<?php 
        print $custom_view_url . $custom_field_url;
        ?>
">
		</form>
	</div>
	<?php 
    }
}
コード例 #27
0
ファイル: controller.php プロジェクト: zooley/hubzero-cms
function task_data($db_id)
{
    global $dv_conf;
    $dd = get_dd($db_id);
    if (!authorize($dd)) {
        print '<br /><p class="error">Sorry, you are not authorized to view this page.</p>';
        return;
    }
    $filter = strtolower(Request::getVar('type', 'json'));
    $file = JPATH_COMPONENT . DS . "filter/{$filter}.php";
    if (file_exists($file)) {
        require_once $file;
    }
    if ($dd) {
        $link = get_db();
        $sql = query_gen($dd);
        $res = get_results($sql, $dd);
        print filter($res, $dd);
        exit(0);
    } else {
        print print "<p class=\"error\">Invalid Request</p>";
        exit(1);
    }
}