Пример #1
0
function save_quote($data)
{
    if (!is_admin()) {
        return;
    }
    $table = "ez_quotes";
    return db_save($table, $data);
}
Пример #2
0
function update_wrapper_730()
{
    include '/usr/share/nginx/html/php/730_core.php';
    $players = get_100_users();
    if (empty($players) || !isset($players[0]['steamid']) || !is_array($players)) {
        die;
    }
    update_730($players);
    db_save('start_steamid_730', $steamid1 + 100);
}
Пример #3
0
 public function testSimpeSave()
 {
     $save = array("content_type" => "page", "subtype" => "static", "title" => "one page", "parent" => "0", "is_deleted" => "0");
     $save_post = array("content_type" => "post", "subtype" => "static", "title" => "one post", "parent" => "0", "is_deleted" => "0");
     $content = db_save('content', $save);
     $content2 = db_save('content', $save);
     $content3 = db_save('content', $save);
     $content4 = db_save('content', $save);
     $content5 = db_save('content', $save_post);
     $content6 = db_save('content', $save_post);
     $this->assertTrue(true, !$content);
     $this->assertTrue(true, !$content2);
     $this->assertTrue(true, $content != $content2);
     $this->assertTrue(true, $content2 != $content3);
     $this->assertTrue(true, $content3 != $content4);
     $this->assertTrue(true, $content4 != $content5);
     $this->assertTrue(true, $content5 != $content6);
 }
Пример #4
0
 public function testLimitAndPaging()
 {
     $add_page = db_save('content', $this->save);
     $add_page = db_save('content', $this->save);
     $add_page = db_save('content', $this->save);
     $add_page = db_save('content', $this->save);
     $pages_count = db_get('content', 'limit=2&count_paging=1');
     $first_page = db_get('content', 'limit=2');
     $second_page = db_get('content', 'limit=2&current_page=2');
     $first_page_items = count($first_page);
     $second_page_items = count($second_page);
     $ids_on_first_page = array();
     foreach ($first_page as $item) {
         $this->assertTrue(isset($item['id']));
         $ids_on_first_page[] = $item['id'];
     }
     foreach ($second_page as $item) {
         $this->assertTrue(isset($item['id']));
         $this->assertFalse(in_array($item['id'], $ids_on_first_page));
     }
     $this->assertEquals($first_page_items, $second_page_items, 'First page item count: ' . $first_page_items . ', second page item count: ' . $second_page_items);
     $this->assertTrue(intval($pages_count) > 1);
     // @todo: fix  the count_paging param to return integer    $this->assertTrue(is_int($pages_count));
 }
Пример #5
0
<?php

include '../../include.php';
if ($posting) {
    langTranslatePost('title,description');
    db_save('pages');
    url_change_post('./');
}
echo drawTop();
$f = new form('pages', @$_GET['id']);
$f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
$f->set_field(array('type' => 'textarea', 'class' => 'tinymce', 'name' => 'description' . langExt(), 'label' => getString('description')));
$f->unset_fields('url,isSecure');
if (url_id('module_id')) {
    $f->set_field(array('type' => 'hidden', 'name' => 'module_id', 'value' => $_GET['module_id']));
} else {
    $f->unset_fields('module_id');
}
if (url_id('modulette_id')) {
    $f->set_field(array('type' => 'hidden', 'name' => 'modulette_id', 'value' => $_GET['modulette_id']));
} else {
    $f->unset_fields('modulette_id');
}
if (isset($_GET['url'])) {
    $f->set_field(array('type' => 'hidden', 'name' => 'url', 'value' => $_GET['url']));
}
langUnsetFields($f, 'title,description');
langTranslateCheckbox($f);
echo $f->draw();
echo drawBottom();
Пример #6
0
<?php

include '../include.php';
if ($posting) {
    error_debug('user is posting', __FILE__, __LINE__);
    if ($uploading) {
        list($_POST['content'], $_POST['type_id']) = file_get_uploaded('content', 'docs_types');
    }
    langTranslatePost('title,description');
    $id = db_save('docs');
    //debug();
    db_checkboxes('categories', 'docs_to_categories', 'documentID', 'categoryID', $id);
    if (getOption('channels')) {
        db_checkboxes('channels', 'docs_to_channels', 'doc_id', 'channel_id', $id);
    }
    url_change('info.php?id=' . $id);
}
if (url_id()) {
    $d = db_grab('SELECT title, description FROM docs WHERE id = ' . $_GET['id']);
    $pageAction = getString('edit');
} else {
    $pageAction = getString('add_new');
}
echo drawTop();
//load code for JS
$extensions = array();
$doctypes = array();
$types = db_query('SELECT description, extension FROM docs_types ORDER BY description');
while ($t = db_fetch($types)) {
    $extensions[] = '(extension != "' . $t['extension'] . '")';
    $doctypes[] = ' - ' . $t['description'] . ' (.' . $t['extension'] . ')';
Пример #7
0
<?php

include '../../include.php';
if ($posting) {
    if ($_GET['doc_id'] == 'new') {
        $_GET['doc_id'] = false;
    }
    if ($uploading) {
        $_POST['extension'] = file_type($_FILES['content']['name']);
        $_POST['content'] = file_get_uploaded('content');
    }
    $id = db_save('dl_docs', @$_GET['doc_id']);
    db_checkboxes('categories', 'dl_docs_to_categories', 'doc_id', 'category_id', $id);
    url_drop('id');
} elseif (url_action('delete')) {
    db_delete('dl_docs');
    url_drop('id,action');
}
echo drawTop();
if (!empty($_GET['doc_id'])) {
    if ($_GET['doc_id'] == 'new') {
        $_GET['doc_id'] = false;
    }
    $f = new form('dl_docs', @$_GET['doc_id'], ($_GET['doc_id'] ? 'Edit' : 'Add') . ' Document');
    $f->set_title_prefix($page['breadcrumbs']);
    $f->set_field(array('name' => 'title', 'label' => getString('title'), 'type' => 'text'));
    $f->unset_fields('extension');
    $f->set_field(array('name' => 'content', 'label' => getString('file'), 'type' => 'file', 'additional' => getString('upload_max') . file_get_max()));
    $f->set_field(array('name' => 'categories', 'label' => getString('categories'), 'type' => 'checkboxes', 'options_table' => 'dl_categories', 'option_title' => 'title', 'linking_table' => 'dl_docs_to_categories', 'object_id' => 'doc_id', 'option_id' => 'category_id'));
    echo $f->draw();
} else {
Пример #8
0
function apiKeyBox()
{
    if (admin_password() && isset($_POST['apikeyfield']) && isset($_POST['apikeysubmit'])) {
        db_save('akey', $_POST['apikeyfield']);
    }
    $apikey = db_load('akey');
    echo '<div class="col2 rt"><h2>Api Key:</h2><br><form action="', $_SERVER['PHP_SELF'], '" method=post><input name="apikeyfield" type="text" placeholder="', $apikey, '"><br><input name="pass" type="password" class="ddinput"><input type=submit name=apikeysubmit value=apikeysubmit></form></div>';
}
Пример #9
0
<?php

include "include.php";
url_query_require();
if ($posting) {
    $_POST['translations_do'] = true;
    langTranslatePost('description');
    $_POST["topic_id"] = $_GET["id"];
    $id = db_save("bb_followups", false);
    db_query('UPDATE bb_topics SET thread_date = GETDATE(), replies = (SELECT COUNT(*) FROM bb_followups WHERE topic_id = ' . $_POST['topic_id'] . ') WHERE id = ' . $_POST['topic_id']);
    //send followup email to all topic contributors
    if (getOption("bb_notifyfollowup")) {
        $addresses = array();
        $languages = db_array('SELECT code FROM languages');
        foreach ($languages as $l) {
            $addresses[$l] = array();
        }
        //get topic poster email, put in correct bucket
        $poster = db_grab("SELECT \n\t\t\t\tu.email, \n\t\t\t\tl.code \n\t\t\tFROM bb_topics t \n\t\t\tJOIN users u ON t.created_user = u.id \n\t\t\tJOIN languages l ON u.language_id = l.id\n\t\t\tWHERE u.is_active = 1 AND t.id = " . $_POST["topic_id"]);
        $addresses[$poster['code']][] = $poster['email'];
        //get followup poster emails
        $repliers = db_table("SELECT \n\t\t\t\tu.email,\n\t\t\t\tl.code\n\t\t\tFROM bb_followups f \n\t\t\tJOIN users u ON u.id = f.created_user \n\t\t\tJOIN languages l ON u.language_id = l.id\n\t\t\tWHERE u.is_active = 1 AND f.is_active = 1 AND f.topic_id = " . $_POST["topic_id"]);
        foreach ($repliers as $r) {
            $addresses[$r['code']][] = $r['email'];
        }
        foreach ($addresses as $lang => $emails) {
            $topic = db_grab('SELECT 
						t.title' . langExt($lang) . ' title, 
						y.title' . langExt($lang) . ' type,
						t.created_date
					FROM bb_topics t
Пример #10
0
<?php

include "../../include.php";
if ($posting) {
    $id = db_save("queries");
    url_change("./");
}
echo drawTop();
if (isset($_GET["id"])) {
    $r = db_grab("SELECT \n\t\t\tq.databaseID,\n\t\t\td.dbname,\n\t\t\tq.name,\n\t\t\tq.description,\n\t\t\tq.query,\n\t\t\tq.is_active\n\t\tFROM queries q \n\t\tJOIN queries_databases d ON d.id = q.databaseID\n\t\tWHERE q.id = " . $_GET["id"]);
    /*db_switch($r["dbname"]);
    	db_query($r["query"], false, true);
    	db_switch($_josh["db"]["database"]);*/
} else {
    $r["is_active"] = 1;
}
$form = new intranet_form();
$form->addRow("hidden", "", "is_active", $r["is_active"]);
$form->addRow("select", "Database", "databaseID", "SELECT id, dbname from queries_databases order by dbname", @$r["databaseID"], true);
$form->addRow("itext", "Name", "name", @$r["name"], "", false, 50);
$form->addRow("textarea", "Description", "description", @$r["description"]);
$form->addRow("textarea-plain", "Query", "query", @$r["query"]);
$form->addRow("submit", "Save Changes");
if (isset($_GET["id"])) {
    $form->draw("<a href='/queries/'>Database Queries</a> &gt; Edit Query");
} else {
    $form->draw("Add New Query");
}
echo drawBottom();
Пример #11
0
<?php

include '../../include.php';
if ($posting) {
    format_post_bits('is_selected');
    langTranslatePost('name,description');
    $id = db_save('soc_members');
    url_change_post('../');
}
echo drawTop();
$f = new form('soc_members', @$_GET['id'], $page['title']);
$f->set_field(array('name' => 'name' . langExt(), 'type' => 'text', 'label' => getString('title')));
$f->set_field(array('name' => 'country_id', 'type' => 'select', 'sql' => 'SELECT id, en FROM jr_countries ORDER BY en'));
$f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'class' => 'tinymce', 'label' => getString('description')));
langUnsetFields($f, 'name,description');
langTranslateCheckbox($f);
$f->set_title_prefix($page['breadcrumbs']);
echo $f->draw();
echo drawBottom();
Пример #12
0
<?php

include "../../include.php";
if ($posting) {
    $id = db_save("web_news_blurbs");
    url_change_post("../");
} elseif (url_action('delete')) {
    db_delete('web_news_blurbs', $_GET['delete_id']);
    url_change('../');
}
echo drawTop();
$f = new form("web_news_blurbs", @$_GET["id"]);
$f->set_title(drawHeader());
echo $f->draw();
echo drawBottom();
Пример #13
0
if ($r["statusID"] != 9) {
    //open
    $typeRequired = false;
} elseif (!$r["type_id"]) {
    //closed, no type
    $typeRequired = false;
} else {
    $typeRequired = true;
}
//$page['is_admin'] = ($page['is_admin'] && ($r["departmentID"] == $_SESSION["departmentID"])) ? true : false;
if ($uploading) {
    //upload an attachment
    $_POST['content'] = file_get_uploaded('userfile');
    $_POST['extension'] = file_ext($_FILES['userfile']['name']);
    $_POST["ticketID"] = $_GET["id"];
    $id = db_save('helpdesk_tickets_attachments', false);
    url_change();
} elseif ($posting) {
    //add a comment
    //auto-assign ticket if unassigned and followup poster is an IT admin
    $followupAdmin = !empty($_POST['is_admin']) ? 1 : 0;
    if ($page['is_admin'] && !$followupAdmin && empty($r["ownerID"])) {
        //set to it staff assigned if no status
        if ($r["statusID"] == 1) {
            $r["statusID"] = 2;
        }
        db_query('UPDATE helpdesk_tickets SET ownerID = ' . user() . ', statusID = ' . $r["statusID"] . ', updated_date = GETDATE() WHERE id = ' . $_GET['id']);
    }
    //insert followup
    db_query('INSERT INTO helpdesk_tickets_followups (
				ticketID, 
Пример #14
0
<?php

include 'include.php';
if ($posting) {
    error_debug('handling bb post', __FILE__, __LINE__);
    format_post_bits('is_admin');
    langTranslatePost('title,description');
    $id = db_save('bb_topics');
    db_query('UPDATE bb_topics SET thread_date = GETDATE(), replies = (SELECT COUNT(*) FROM bb_followups WHERE topic_id = ' . $id . ') WHERE id = ' . $id);
    if (getOption('channels')) {
        db_checkboxes('channels', 'bb_topics_to_channels', 'topic_id', 'channel_id', $id);
    }
    //notification
    if ($_POST['is_admin'] == '1') {
        //get addresses of everyone & send with message
        emailUser(db_array('SELECT email FROM users WHERE is_active = 1'), $_POST['title'], drawEmail(bbDrawTopic($id, true)));
    } elseif (getOption('bb_notifypost') && getOption('channels') && getOption('languages')) {
        //get addresses of everyone with indicated interests and send
        $channels = array_post_checkboxes('channels');
        $languages = db_table('SELECT id, code FROM languages');
        foreach ($languages as $l) {
            $addresses = db_array('SELECT DISTINCT u.email FROM users u JOIN users_to_channels_prefs u2cp ON u.id = u2cp.user_id WHERE u.is_active = 1 AND u.language_id = ' . $l['id'] . ' AND u2cp.channel_id IN (' . implode(',', $channels) . ')');
            $topic = db_grab('SELECT 
						ISNULL(u.nickname, u.firstname) firstname, 
						u.lastname, 
						t.title' . langExt($l['code']) . ' title, 
						t.description' . langExt($l['code']) . ' description, 
						y.title' . langExt($l['code']) . ' type,
						t.created_date
					FROM bb_topics t
					LEFT JOIN bb_topics_types y ON t.type_id = y.id
Пример #15
0
<?php

include "../../include.php";
if ($posting) {
    langTranslatePost('title');
    $id = db_save('links');
    url_drop('id');
} elseif (url_action('delete') && url_id('delete_id')) {
    db_delete('links', $_GET['delete_id']);
    url_drop('delete_id,action');
}
echo drawTop();
if (url_id()) {
    //form
    $f = new form('links', @$_GET['id']);
    $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
    langUnsetFields($f, 'title');
    langTranslateCheckbox($f);
    echo $f->draw();
} else {
    //modules list
    $t = new table('links', drawHeader());
    $t->set_column('draggy', 'd', '&nbsp;');
    $t->set_column('title', 'l', getString('title'));
    $t->set_column('delete', 'd', '&nbsp;');
    $result = db_table('SELECT l.id, l.title' . langExt() . ' title FROM links l WHERE l.is_active = 1 ORDER BY l.precedence');
    $t->set_draggable('draggy');
    foreach ($result as &$r) {
        $r['draggy'] = draw_img('/images/icons/move.png');
        $r['title'] = draw_link('links.php?id=' . $r['id'], $r['title']);
        $r['delete'] = drawColumnDelete($r['id']);
Пример #16
0
function resetUpdateCounters($id)
{
    if ($id == 'prices') {
        db_save('440_pricelist_v4_time', (int) 0);
    }
    if ($id == 'schema') {
        db_save('440_schema_time', (int) 0);
    }
}
Пример #17
0
<?php

$included = isset($_josh);
if (!$included) {
    include '../include.php';
}
$r = array();
if ($posting) {
    langTranslatePost('title,description');
    $id = db_save('external_orgs');
    db_checkboxes('types', 'external_orgs_to_types', 'org_id', 'type_id', $id);
    if (getOption('channels')) {
        db_checkboxes('channels', 'external_orgs_to_channels', 'org_id', 'channel_id', $id);
    }
    url_change_post('./type.php?id=' . db_grab('SELECT type_id FROM external_orgs_to_types WHERE org_id = ' . $id));
    //pure hackery
} elseif ($included) {
    $title = getString('add_new');
    $_josh['referrer'] = false;
    $_josh['request']['path_query'] = 'edit.php';
    //shoddy way of setting the form target
    $r['url'] = 'http://';
} else {
    url_query_require();
    echo drawTop();
    $title = $page['title'];
    $r = db_grab('SELECT id, title, url, description from external_orgs WHERE id = ' . $_GET['id']);
}
if ($included) {
    $_GET['id'] = false;
}
Пример #18
0
<?php

include '../../include.php';
if ($posting) {
    if ($_GET['category_id'] == 'new') {
        $_GET['category_id'] = false;
    }
    $id = db_save('dl_categories', @$_GET['category_id']);
    url_drop('category_id');
} elseif (url_action('delete')) {
    db_delete('dl_categories');
    url_drop('action,id');
}
echo drawTop();
if (!empty($_GET['category_id'])) {
    //category form
    if ($_GET['category_id'] == 'new') {
        $_GET['category_id'] = false;
    }
    $f = new form('dl_categories', $_GET['category_id'], ($_GET['category_id'] ? 'Edit' : 'Add') . ' Category');
    $f->set_title_prefix($page['breadcrumbs']);
    echo $f->draw();
} else {
    //list of categories
    $result = db_table('SELECT id, title, ' . db_updated() . ' FROM dl_categories WHERE is_active = 1 ORDER BY precedence');
    $links = $page['is_admin'] ? array(url_query_add(array('category_id' => 'new'), false) => getString('add_new')) : false;
    $t = new table('dl_categories', drawHeader($links));
    $t->set_column('draggy', 'd', '&nbsp;');
    $t->set_column('title', 'l', getString('title'));
    $t->set_column('updated', 'r', getString('updated'));
    $t->set_column('delete', 'd', '&nbsp;');
Пример #19
0
<?php

include "../../include.php";
url_query_require();
if ($posting) {
    $id = db_save("wiki_topics");
    db_checkboxes("tags", "wiki_topics_to_tags", "topicID", "tagID", $id);
    url_change("topic.php?id=" . $id);
}
echo drawTop();
$r = db_grab("SELECT id, title, description, type_id FROM wiki_topics WHERE id = " . $_GET["id"]);
$form = new intranet_form();
if ($page['is_admin']) {
    $form->addUser("created_user", "Posted By", $_SESSION["user_id"], false, true);
}
$form->addRow("itext", "Title", "title", $r["title"], "", true, 255);
$form->addRow("select", "Type", "type_id", "SELECT id, description FROM wiki_topics_types", $r["type_id"], true);
$form->addCheckboxes("tags", "Tags", "wiki_tags", "wiki_topics_to_tags", "topicID", "tagID", $_GET["id"]);
$form->addRow("textarea", "Description", "description", $r["description"], "", true);
$form->addRow("submit", "post wiki topic");
$form->draw("Add a Wiki Topic");
echo drawBottom();
Пример #20
0
<?php

include "../../include.php";
if ($posting) {
    langTranslatePost('title');
    $id = db_save('modules');
    url_drop('id');
}
echo drawTop();
if (url_id()) {
    //form
    $f = new form('modules', @$_GET['id']);
    $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
    langUnsetFields($f, 'title');
    langTranslateCheckbox($f);
    echo $f->draw();
} else {
    //modules list
    $t = new table('modules', drawHeader());
    $t->set_column('is_selected', 'd', '&nbsp;');
    $t->set_column('draggy', 'd', '&nbsp;');
    $t->set_column('title', 'l', getString('title'));
    $t->set_column('pages', 'r');
    $result = db_table('SELECT m.id, m.title' . langExt() . ' title, m.is_active, (SELECT COUNT(*) FROM pages p WHERE p.module_id = m.id AND p.modulette_id IS NULL) pages FROM modules m ORDER BY m.precedence');
    $t->set_draggable('draggy');
    foreach ($result as &$r) {
        $r['is_selected'] = draw_form_checkbox('foo', $r['is_active'], false, 'ajax_set(\'modules\', \'is_active\', ' . $r['id'] . ', ' . abs($r['is_active'] - 1) . ');');
        $r['draggy'] = draw_img('/images/icons/move.png');
        $r['title'] = draw_link('./?id=' . $r['id'], $r['title']);
        $r['pages'] = draw_link('pages.php?module_id=' . $r['id'], format_quantitize($r['pages'], 'page'));
    }
Пример #21
0
<?php

include "include.php";
if ($posting) {
    langTranslatePost('title,description');
    $id = db_save('cal_events');
    if (getOption('channels')) {
        db_checkboxes('channels', 'cal_events_to_channels', 'event_id', 'channel_id', $id);
    }
    url_query_add(array("month" => $_POST['start_dateMonth'], "year" => $_POST['start_dateYear']));
}
if (!isset($_GET['month']) || !isset($_GET['year'])) {
    url_query_add(array("month" => $_josh['month'], "year" => $_josh['year']));
}
echo drawTop();
echo drawNavigationCal($_GET['month'], $_GET['year']);
//get events
$result = db_query('SELECT 
			e.id,
			DAY(e.start_date) startDay,
			e.title' . langExt() . ' title,
			t.color
		FROM cal_events e
		JOIN cal_events_types t ON e.type_id = t.id
	' . getChannelsWhere('cal_events', 'e', 'event_id') . '
			AND 
			MONTH(e.start_date) = ' . $_GET['month'] . ' AND
			YEAR(e.start_date) = ' . $_GET['year']);
while ($r = db_fetch($result)) {
    $events[$r['startDay']][$r['id']]['title'] = $r['title'];
    $events[$r['startDay']][$r['id']]['color'] = $r['color'];
Пример #22
0
<?php

include "../../include.php";
if (url_action("delete")) {
    db_delete("openings");
    url_drop();
} elseif ($posting) {
    //debug();
    if ($id = db_save("openings")) {
        url_change("position.php?id=" . $id);
    }
}
echo drawTop();
?>
<table class="left" cellspacing="1">
	<?php 
if ($page['is_admin']) {
    $colspan = 4;
    echo drawHeaderRow("Open Positions", $colspan, "new", "#bottom");
} else {
    $colspan = 3;
    echo drawHeaderRow("Open Positions", $colspan);
}
?>
	<tr>
		<th width="50%">Title</th>
		<th width="30%">Location</th>
		<th class="r" width="20%"><nobr>Last Update</nobr></th>
		<?php 
if ($page['is_admin']) {
    ?>
Пример #23
0
        $price = sprintf("%.2f", $item['valve_avg'] / 100);
    } else {
        if (isset($price) && $price != 0 && $price != -1) {
            $price = sprintf("%.2f", cs_price($item['name']) / 100);
        } else {
            $price = 0;
            $num_unpriced++;
        }
    }
    echo '<tr><td><img src="' . $item['img_url'] . '"></td><td data-sort-value="' . $price . '">' . ($price != 0 ? $price : 'N/A') . '</td><td>' . $item['name'] . '</td></tr>';
    $pricelist[$item['name']] = array('img' => $item['img_url'], 'price' => $price, 'classid' => isset($item['classid']) ? $item['classid'] : '');
}
echo '</table>';
echo $num_unpriced, ' Unpriced items remain.';
file_put_contents(json_directory() . '/cs_schema.json', json_encode($pricelist));
db_save('730_schemalist_time', array('time' => time(), 'priced' => $num_priced));
//echo '<br><br>';
//echo cs_price( 'Nova | Tempest (Minimal Wear)' );
function cs_price($itemName)
{
    $col = db_init('market_730', 'item_prices');
    //old query that worked: array( array( '$match' => array( 'name' =>$itemName ) ), array( '$group' => array( '_id'=>null,  'avgPrice' => array( '$avg'=> '$price' ) ) ) );
    $count = $col->count(array("name" => "{$itemName}"));
    if ($count == 0) {
        //$res = json_decode( get_data( 'http://steamcommunity.com/market/priceoverview/?appid=730&market_hash_name=' . urlencode( $itemName ) ), true );
        //if(isset($res['success'] ) && $res['success'] == true && (isset($res['lowest_price']) || isset($res['median_price']) ) ){
        // if (isset($res['median_price']))
        //  return substr($res['median_price'], 1);
        // if (isset($res['lowest_price']))
        //  return substr($res['lowest_price'], 1);
        //}
Пример #24
0
<?php

include "include.php";
if ($posting) {
    $id = db_save("helpdesk_tickets_types");
    url_change("type.php?id=" . $id);
}
echo drawTop();
if (isset($_GET["id"])) {
    $result = db_query("SELECT description FROM helpdesk_tickets_types WHERE id = " . $_GET["id"]);
    $r = db_fetch($result);
}
$form = new intranet_form();
$form->addRow("itext", "Type Name", "description", @$r["description"]);
if (isset($_GET["id"])) {
    $form->addRow("submit", "Save Changes");
    $form->draw("Edit Ticket Type");
} else {
    $form->addRow("submit", "Add Type");
    $form->draw("Add New Ticket Type");
}
echo drawBottom();
Пример #25
0
function download_chunks($chunklist, $effective_url)
{
    global $db, $prefix, $filetime;
    $mh = curl_multi_init();
    $connections = array();
    $files = array();
    curl_multi_setopt($mh, CURLMOPT_PIPELINING, 1);
    curl_multi_setopt($mh, CURLMOPT_MAXCONNECTS, 1);
    foreach ($chunklist as $chunk) {
        if (db_is_file_downloaded($db, $chunk["filename"])) {
            // this file is already downloaded, skip downloading
            l("skip downloading: : " . $chunk["filename"]);
            // fill in the corresponding array elements to make these arrays synchronized with $chunklist
            $connections[] = null;
            $files[] = null;
            continue;
        }
        l("going to download: " . $chunk["filename"]);
        $url = str_replace("playlist.m3u8", $chunk["filename"], $effective_url);
        $c = new_curl($url);
        $f = fopen(DATA_DIR . $chunk["filename"], "w");
        curl_setopt($c, CURLOPT_FILE, $f);
        curl_multi_add_handle($mh, $c);
        $connections[] = $c;
        $files[] = $f;
    }
    //execute the handles
    $still_running;
    do {
        $mrc = curl_multi_exec($mh, $still_running);
        curl_multi_select($mh, 5);
    } while ($still_running > 0);
    l("all downloads finished");
    $t = $filetime;
    for ($i = 0; $i < count($connections); $i++) {
        $c = $connections[$i];
        $chunk = $chunklist[$i];
        if ($c) {
            curl_multi_remove_handle($mh, $c);
            $status = curl_getinfo($c, CURLINFO_HTTP_CODE);
            if ($status == 200) {
                db_add_file($db, $t, $chunk["filename"], $chunk["duration"]);
            } else {
                l("chunk download failed, status: " . $status . ", filename: " . $chunk["filename"]);
            }
            $t += $chunk["duration"];
        }
    }
    $filetime = $t;
    foreach ($files as $f) {
        if ($f) {
            fclose($f);
        }
    }
    curl_multi_close($mh);
    db_save($db);
}
Пример #26
0
<?php

include "../../include.php";
if ($posting) {
    $id = db_save("wiki_topics_types");
    url_change();
}
echo drawTop();
?>
<table class="left" cellspacing="1">
	<?php 
echo drawHeaderRow("Types", 2);
$tags = db_query("SELECT \n\t\tt.id, \n\t\tt.description,\n\t\t(SELECT COUNT(*) FROM wiki_topics w WHERE w.type_id = t.id) topics\n\t\tFROM wiki_topics_types t \n\t\tWHERE t.is_active = 1\n\t\tORDER BY t.description");
if (db_found($tags)) {
    ?>
	<tr>
		<th align="left">Type</th>
		<th align="right">#</th>
	</tr>
	<?php 
    while ($t = db_fetch($tags)) {
        ?>
	<tr>
		<td><?php 
        if ($t["topics"]) {
            ?>
<a href="type.php?id=<?php 
            echo $t["id"];
            ?>
"><?php 
        }
Пример #27
0
<?php

include "../../include.php";
if ($posting) {
    langTranslatePost('title');
    $id = db_save('organizations');
    url_drop('id');
} elseif (url_action('delete') && url_id('delete_id')) {
    db_delete('organizations', $_GET['delete_id']);
    url_drop('delete_id,action');
}
echo drawTop();
if (url_id()) {
    //form
    $f = new form('organizations', @$_GET['id']);
    $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
    langUnsetFields($f, 'title');
    langTranslateCheckbox($f);
    echo $f->draw();
} else {
    //modules list
    $t = new table('organizations', drawHeader());
    $t->set_column('draggy', 'd', '&nbsp;');
    $t->set_column('title', 'l', getString('title'));
    $t->set_column('delete', 'd', '&nbsp;');
    $result = db_table('SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence');
    foreach ($result as &$r) {
        $r['draggy'] = draw_img('/images/icons/move.png');
        $r['title'] = draw_link('organizations.php?id=' . $r['id'], $r['title']);
        $r['delete'] = drawColumnDelete($r['id']);
    }
Пример #28
0
<?php

$included = isset($_josh);
if (!$included) {
    include '../include.php';
}
$r = false;
if ($posting) {
    langTranslatePost('title,description,publication');
    $id = db_save("press_clips");
    if (getOption('channels')) {
        db_checkboxes('channels', 'press_clips_to_channels', 'clip_id', 'channel_id', $id);
    }
    url_change_post("/press-clips/clip.php?id=" . $id);
} elseif ($included) {
    $action = getString('add_new');
    $_josh["request"]["path_query"] = "edit.php";
    //shoddy way of setting the form target
    $r["url"] = "http://";
} elseif (url_id()) {
    $action = getString('edit');
    echo drawTop();
    $r = db_grab("SELECT id, title, url, publication, pub_date, description, type_id from press_clips WHERE id = " . $_GET["id"]);
    $r["title"] = format_title($r["title"], "US");
} else {
    $action = getString('add_new');
    echo drawTop();
    if (isset($_GET["title"])) {
        $r["title"] = format_title($_GET["title"], "US");
    }
    if (isset($_GET["url"])) {
Пример #29
0
<?php

include "../../include.php";
if (url_action("delete")) {
    db_delete('board_members');
    url_drop();
} elseif ($posting) {
    $id = db_save('board_members');
    url_change();
}
echo drawTop();
echo drawTableStart();
if ($page['is_admin']) {
    $colspan = 2;
    echo drawHeaderRow("Board Members", $colspan, "new", "#bottom");
} else {
    $colspan = 3;
    echo drawHeaderRow("Board Members", $colspan);
}
$result = db_query("SELECT\n\t\t\t\tm.id,\n\t\t\t\tm.firstname,\n\t\t\t\tm.lastname,\n\t\t\t\tm.board_position,\n\t\t\t\to.description organization\n\t\t\tFROM board_members m\n\t\t\tJOIN organizations o ON m.organization_id = o.id\n\t\t\tWHERE m.is_active = 1\n\t\t\tORDER BY o.description, m.lastname, m.firstname");
if (db_found($result)) {
    ?>
	<tr>
		<th align="left" width="60%">Name</th>
		<th align="left" width="40%">Position on Board</th>
		 <?php 
    if ($page['is_admin']) {
        echo "<th width='16'></th>";
    }
    ?>
	</tr>
Пример #30
-1
if (isset($_josh)) {
    //included
    $_josh["request"]["path_query"] = "/news/edit.php";
} else {
    //page loaded on its own
    include "../../include.php";
    if ($posting) {
        if (isset($_FILES["content"]["name"]) && !empty($_FILES["content"]["name"])) {
            list($_POST["content"], $_POST["fileTypeID"]) = file_get_uploaded("content", "docs_types");
        }
        if (isset($_FILES["image"]["name"]) && !empty($_FILES["image"]["name"])) {
            list($_POST["image"], $_POST["imageTypeID"]) = file_get_uploaded("image", "docs_types");
            //die($_POST["image"]);
        }
        $id = db_save("news_stories");
        db_checkboxes("corporationID", "news_stories_to_organizations", "newsID", "organizationID", $id);
        url_change("./?id=" . $id);
    }
    echo drawTop();
    $r = db_grab("SELECT \n\t\tn.headline,\n\t\tn.outlet,\n\t\tn.pubdate,\n\t\tn.url,\n\t\tn.description\n\t\tFROM news_stories n\n\t\tWHERE id = " . $_GET["id"]);
}
$form = new intranet_form();
$form->addCheckboxes("corporationID", "Organization", "organizations", "news_stories_to_organizations", "newsID", "organizationID", @$_GET["id"]);
$form->addRow("itext", "Headline", "headline", @$r["headline"], "", true, 255);
$form->addRow("itext", "News Outlet", "outlet", @$r["outlet"], "", true, 255);
$form->addRow("date", "Date", "pubdate", @$r["pubdate"], "", true);
$form->addRow("file", "Image<br>(optional)", "image", "", "", false);
$form->addRow("file", "File<br>(optional)", "content", "", "", true);
$form->addRow("itext", "URL<br>(optional)", "url", @$r["url"], "", false, 255);
$form->addRow("textarea-plain", "Description<br>(optional)", "description", @$r["description"]);