Esempio n. 1
0
function set_jury($nazov)
{
    if ($link = db_connect()) {
        $sql = "UPDATE organisators as o SET validated = '1'  WHERE o.user_id='" . $nazov . "'";
        //      echo "sql = $sql <br>";
        $result = mysqli_query($link, $sql);
        // vykonaj dopyt
        if ($result) {
            // dopyt sa podarilo vykonať
            echoMessage('m-acc-validated');
        } else {
            // dopyt sa NEpodarilo vykonať!
            echoError('err-acc-validation');
        }
        mysqli_close($link);
    } else {
        // NEpodarilo sa spojiť s databázovým serverom!
        echoError('err-db-connection-fail');
    }
}
Esempio n. 2
0
function set_date($contextid, $start_dat, $end_dat)
{
    if ($link = db_connect()) {
        $sql = "UPDATE assignments as a SET begin = '" . $start_dat . "' , end='" . $end_dat . "'  WHERE a.context_id='" . $contextid . "'";
        //      echo "sql = $sql <br>";
        $result = mysqli_query($link, $sql);
        // vykonaj dopyt
        if ($result) {
            // dopyt sa podarilo vykonať
            echoMessage('m-date-changed');
        } else {
            // dopyt sa NEpodarilo vykonať!
            echoError('err-date-changing');
        }
        mysqli_close($link);
    } else {
        // NEpodarilo sa spojiť s databázovým serverom!
        echoError('err-db-connection-fail');
    }
}
Esempio n. 3
0
function fieldPlays($method, $target, $payload)
{
    switch ($method) {
        case "GET":
            checkNULL($target, 'device');
            checkDevice($target, 'has_device');
            $result = dbSelect('devices', 'devicetime', "tag='" . $target . "'");
            $response = $result->fetch_assoc();
            httpResponse($response, 200);
            break;
        case "POST":
            checkNULL($target, 'room');
            checkRoom($target, 'has_room');
            checkNULL($payload['user'], 'user');
            checkOnline($payload['user']);
            dbUpdate('devices', "command='" . $payload['cmd'] . "', timestamp='" . $payload['ts'] . "'", "location='" . $target . "'");
            echoSuccess("set_play");
            break;
        case "PUT":
            checkNULL($target, 'device');
            checkDevice($target, 'has_device');
            dbUpdate('devices', "devicetime='" . $payload['dt'] . "'", "tag='" . $target . "'");
            $result = dbSelect('devices', 'command, timestamp', "tag='" . $target . "'");
            $response = $result->fetch_assoc();
            httpResponse($response, 200);
            dbUpdate('devices', "command=''", "tag='" . $target . "'");
            break;
        case "DELETE":
            checkNULL($target, 'room');
            checkRoom($target, 'has_room');
            dbUpdate('devices', "command='', timestamp=''", "location='" . $target . "'");
            echoSuccess("reset_play");
            break;
        default:
            echoError('Invalid Method');
            break;
    }
}
Esempio n. 4
0
}
if (isset($args['updatefeeds'])) {
    updateFeeds();
}
if (isset($args['addfeed'])) {
    if (isset($args[$indexCounter])) {
        addFeed($args[$indexCounter++]);
    } else {
        echoError($argv);
    }
}
if (isset($args['addtorrent'])) {
    if (isset($args[$indexCounter]) && isset($args[$indexCounter + 1])) {
        addTorrent($args[$indexCounter++], $args[$indexCounter++]);
    } else {
        echoError($argv);
    }
}
exit(0);
/*
 * From: http://pwfisher.com/nucleus/index.php?itemid=45
 */
function parseArgs($argv)
{
    array_shift($argv);
    $o = array();
    foreach ($argv as $a) {
        if (substr($a, 0, 2) == '--') {
            $eq = strpos($a, '=');
            if ($eq !== false) {
                $o[substr($a, 2, $eq - 2)] = substr($a, $eq + 1);
Esempio n. 5
0
 public function deleteAttachments1($conn, $prilohy, $kde)
 {
     foreach ($prilohy as $value) {
         $pole = explode(";", $value);
         $sql = "SELECT * FROM " . $pole[0] . "s WHERE " . $pole[0] . "_id='" . $pole[1] . "'";
         $result = mysqli_query($conn, $sql);
         if ($result) {
             if ($pole[0] != "video") {
                 $attachment = mysqli_fetch_array($result);
                 $ext = pathinfo($attachment['original_name'], PATHINFO_EXTENSION);
             }
             $sql = "DELETE FROM " . $pole[0] . "s WHERE " . $pole[0] . "_id='" . $pole[1] . "'";
             $result = mysqli_query($conn, $sql);
             if ($result) {
                 if ($pole[0] != "video") {
                     if ($pole[0] == "image") {
                         if (unlink($kde . $pole[0] . "s/big/" . $pole[1] . "." . $ext) && unlink($kde . $pole[0] . "s/small/" . $pole[1] . "." . $ext)) {
                             echoMessage("m-attachment-deleted");
                         } else {
                             echoError("err-attachment-deletion");
                         }
                     } else {
                         if (unlink($kde . $pole[0] . "s/" . $pole[1] . "." . $ext)) {
                             echoMessage("m-attachment-deleted");
                         } else {
                             echoError("err-attachment-deletion");
                         }
                     }
                 }
             } else {
                 echoMessage("m-attachment-deleted");
             }
         } else {
             echoError("err-attachment-db-deletion", mysqli_error($conn));
         }
     }
     /*else {
     			echoError("err-attachment-not-in-db");
     			}
     		}*/
 }
Esempio n. 6
0
    echo $udaje["description"];
}
?>
</textarea></td>
  </tr>
  <tr>
  <td><input type="radio" checked name="liga" value=1<?php 
if (isset($udaje['sk_league']) && $udaje["sk_league"] == 1) {
    echo ' checked';
}
?>
><span data-trans-key="edit-team-form"></span></td>
  <td><input type="radio" name="liga" value=0<?php 
if (isset($udaje['sk_league']) && $udaje["sk_league"] == 0) {
    echo ' checked';
}
?>
><span data-trans-key="edit-team-form"></span></td>
  </tr>
  <tr>
  <td><input type="submit" name="save" data-trans-key="edit-team-form"></td>
  </tr>
  </table>
  </form>


  <?php 
echoMessage($edit->GetMessage());
$err = $val->GetErrorMessage();
echoError(!empty($err) ? $err : $edit->GetErrorMessage());
page_footer();
Esempio n. 7
0
function delete_assignment($id)
{
    if ($link = db_connect()) {
        $sql = "SELECT context_id, text_id_name, text_id_description FROM assignments WHERE context_id = " . $id;
        $result = mysqli_query($link, $sql);
        if ($result && mysqli_num_rows($result) != 0) {
            $assignment = mysqli_fetch_array($result);
            $sql = "DELETE FROM texts WHERE text_id = " . $assignment['text_id_name'] . " OR text_id = " . $assignment['text_id_description'];
            if (!mysqli_query($link, $sql)) {
                echoError('err-assignment-deleting');
                return;
            }
            $sql = "DELETE FROM videos WHERE context_id = " . $assignment['context_id'];
            if (!mysqli_query($link, $sql)) {
                echoError('err-assignment-deleting');
                return;
            }
            $sql = "DELETE FROM images WHERE context_id = " . $assignment['context_id'];
            if (!mysqli_query($link, $sql)) {
                echoError('err-assignment-deleting');
                return;
            }
            $sql = "DELETE FROM programs WHERE context_id = " . $assignment['context_id'];
            if (!mysqli_query($link, $sql)) {
                echoError('err-assignment-deleting');
                return;
            }
            $sql = "DELETE FROM assignments WHERE context_id = " . $assignment['context_id'];
            if (!mysqli_query($link, $sql)) {
                echoError('err-assignment-deleting');
                return;
            }
            if (!deleteDir(dirname(__FILE__) . "/../attachments/assignments/" . $assignment['context_id'])) {
                echoError('err-assignment-deleting');
                return;
            }
            echoMessage('m-assignment-deleted');
        } else {
            echoError('err-assignment-deleting');
        }
    } else {
        echoError('err-db-connection-fail');
    }
}
Esempio n. 8
0
function echoSession($sessionid)
{
    global $db;
    $session = pg_fetch_object(pg_query($db, "SELECT * FROM \"usersession\" WHERE id = " . $sessionid));
    if (is_object($session)) {
        $qrcodefile = QRCODE_PATH . $session->tabletid . ".png";
        if (!is_file($qrcodefile)) {
            shell_exec("qrencode -o \"" . $qrcodefile . "\" -s 25 \"" . $session->tabletid . "\"");
        }
        echo '
<session>
  <id>' . $session->id . '</id>
  <tabletid>' . $session->tabletid . '</tabletid>
  <qrcodepath><![CDATA[' . substr($qrcodefile, strlen(ROOT_PATH)) . ']]></qrcodepath>
  <qrcodeurl><![CDATA[http://' . $_SERVER['HTTP_HOST'] . substr($qrcodefile, strlen(ROOT_PATH)) . ']]></qrcodeurl>';
        if ($session->userid > 0) {
            echo '
  <userid>' . $session->userid . '</userid>';
        }
        echo '
  <startedat>' . $session->startedat . '</startedat>';
        if ($session->committedat != '') {
            echo '
  <committedat>' . $session->committedat . '</committedat>';
        }
        if ($session->sentat != '') {
            echo '
  <sentat>' . $session->sentat . '</sentat>';
        }
        if ($session->finishedat != '') {
            echo '
  <finishedat>' . $session->finishedat . '</finishedat>';
        }
        echo '
  <languageid>' . $session->languageid . '</languageid>';
        $gestures = pg_query($db, "SELECT sg.gestureid, sg.sequence, sg.collectedat, sg.committed,\n                                      g.themeid, g.iconsmallpath, g.co2impact, gt.txt AS name FROM sessiongestures sg\n                                 LEFT JOIN usersession s ON s.id = sg.sessionid\n                                 LEFT JOIN gesture g ON g.id = sg.gestureid\n                                 LEFT JOIN gesturetext gt ON gt.id = sg.gestureid AND\n                                                             gt.languageid = s.languageid AND\n                                                             gt.contenttype = 'name'\n                                WHERE sg.sessionid = " . $session->id . "\n                                ORDER BY sequence");
        if (pg_num_rows($gestures) > 0) {
            echo '
    <gestures>';
            while (is_object($gesture = pg_fetch_object($gestures))) {
                echo '
      <gesture>
        <gestureid>' . $gesture->gestureid . '</gestureid>
        <sequence>' . $gesture->sequence . '</sequence>
        <collectedat>' . $gesture->collectedat . '</collectedat>
        <committed>' . ($gesture->committed == "t" ? "1" : "0") . '</committed>
        <themeid>' . $gesture->themeid . '</themeid>
        <iconsmallpath><![CDATA[' . $gesture->iconsmallpath . ']]></iconsmallpath>
        <iconsmallurl><![CDATA[http://' . $_SERVER['HTTP_HOST'] . $gesture->iconsmallpath . ']]></iconsmallurl>
        <co2impact>' . $gesture->co2impact . '</co2impact>
        <name><![CDATA[' . $gesture->name . ']]></name>
      </gesture>';
            }
            echo '
    </gestures>';
        }
        $messages = pg_query($db, "SELECT sm.gestureid, sm.sequence, sm.collectedat, sm.sent,\n                                      g.themeid, g.iconsmallpath, g.co2impact, gt.txt AS name FROM sessionmessages sm\n                                 LEFT JOIN usersession s ON s.id = sm.sessionid\n                                 LEFT JOIN gesture g ON g.id = sm.gestureid\n                                 LEFT JOIN gesturetext gt ON gt.id = sm.gestureid AND\n                                                             gt.languageid = s.languageid AND\n                                                             gt.contenttype = 'name'\n                                WHERE sm.sessionid = " . $session->id . "\n                                ORDER BY sequence");
        if (pg_num_rows($messages) > 0) {
            echo '
    <messages>';
            while (is_object($gesture = pg_fetch_object($messages))) {
                echo '
      <gesture>
        <gestureid>' . $gesture->gestureid . '</gestureid>
        <sequence>' . $gesture->sequence . '</sequence>
        <collectedat>' . $gesture->collectedat . '</collectedat>
        <sent>' . ($gesture->sent == "t" ? "1" : "0") . '</sent>
        <themeid>' . $gesture->themeid . '</themeid>
        <iconsmallpath><![CDATA[' . $gesture->iconsmallpath . ']]></iconsmallpath>
        <iconsmallurl><![CDATA[http://' . $_SERVER['HTTP_HOST'] . $gesture->iconsmallpath . ']]></iconsmallurl>
        <co2impact>' . $gesture->co2impact . '</co2impact>
        <name><![CDATA[' . $gesture->name . ']]></name>
      </gesture>';
            }
            echo '
    </messages>';
        }
        echo '
</session>';
    } else {
        echoError(11, $sessionid);
    }
}
Esempio n. 9
0
    echo ' checked';
}
?>
 ><span data-trans-key="reg-form"></span></td>
  </tr>
  <tr>
  <td><input type="submit" name="registrovat" data-trans-key="reg-form"></td>
  </tr>
  </table>
  </form>

  <script>
    $("[name=type]").change(function (){
      var disabled = $("[name=type]:checked").val() == 1;
      $("#uname").attr("disabled", disabled);
      $("#os").attr("disabled", disabled);
      $("[name=liga]").attr("disabled", disabled);
    });
    $(document).ready(function(){
      $("[name=type]").change();
    });
  </script>

<?php 
echoMessage($reg->GetMessage());
$err = $val->GetErrorMessage();
echoError(!empty($err) ? $err : $reg->GetErrorMessage());
page_footer();
?>

Esempio n. 10
0
function checkSVNUrl($svn_url = "")
{
    if (empty($svn_url) || $svn_url == 'https://svn1.intra.sina.com.cn/netdev/support/trunk/' || $svn_url == 'https://svn1.intra.sina.com.cn/netdev/support/trunk') {
        echoError("此项目暂未做过配置, 请登陆http://admin.alarm.mix.sina.com.cn 修改项目配置\n");
    }
}
Esempio n. 11
0
 /**
  * check table entry
  *
  * This function is being used to check whether a record exists in a table or not against provided primary KEY of the table. 
  * It will return total number of rows found against provided tblField and value.
  *
  * @param $queryTbl 		name of the table to be queried
  * @param $fieldValue 	value of the field to look for
  * @param $tblField		table field, by default its ID
  * @param $qry_options	QRY OPTIONS, by default empty
  *
  *
  */
 public function checkTableEntry($queryTbl, $fieldValue, $tblField = "ID", $qry_options = "")
 {
     //---- check if database table exists or not
     if (!($check = $this->checkTable($queryTbl))) {
         echoError("Invalid table name ''" . $queryTbl . "'' requested|" . __FUNCTION__ . "|" . __LINE__ . "|" . get_parent_class($this) . "|");
         exit;
     }
     //---- run qry and return number of rows
     $sql = "SELECT " . $tblField . " FROM " . $queryTbl . " WHERE " . $tblField . " = '" . $fieldValue . "' " . $qry_options;
     $result = $this->CR->db->runSQL($sql);
     return $result->num_rows;
 }
Esempio n. 12
0
                } else {
                    if ($link = db_connect()) {
                        $sql = "SELECT * FROM assignments a, contexts c, organisators o WHERE c.user_id = o.user_id AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.context_id = a.context_id AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.context_id = " . $_POST["id"] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.user_id = " . $_SESSION["loggedUser"]->getId() . " ";
                        $result = mysqli_query($link, $sql);
                        if ($result && mysqli_num_rows($result) != 0 || isUserTypeLogged("Administrator")) {
                            ?>
 <meta http-equiv="refresh" content="0;url=addAssignment.php?id=<?php 
                            echo $_POST["id"];
                            ?>
"><?php 
                        } else {
                            echoError('err-edit-assignment-rights');
                        }
                        mysqli_close($link);
                    } else {
                        echoError('err-db-connection-fail');
                    }
                }
            }
        }
    }
}
if (isUserTypeLogged("Administrator") || isUserTypeLogged("Jury")) {
    prehlad_zadani(false);
    ?>
	<br>
	<form action="addAssignment.php">
		<input type="submit" data-trans-key="new-assignment">
	</form>
	<br>
	<?php 
Esempio n. 13
0
function setVisualizationState()
{
    global $db;
    $on = isset($_REQUEST["on"]) ? (bool) $_REQUEST["on"] : false;
    $userid = isset($_REQUEST["userid"]) ? (int) $_REQUEST["userid"] : 0;
    // <!-- setVisualizationState(on='.$on.', userid='.$userid.')-->';
    if ($on) {
        if ($userid == 0) {
            echoError(2);
            return;
        }
        if (setVisualizationActiveDB($userid) == 0) {
            echoError(20);
            return;
        }
    } else {
        pg_query($db, "UPDATE exhibitionstate SET visualizationuserid = NULL");
    }
    $exhibitionstate = getExhibitionState();
    if (is_object($exhibitionstate)) {
        echo '
<visualizationstate>';
        if ($exhibitionstate->visualizationuserid > 0) {
            echo '
  <on>1</on>
  <userid>' . $exhibitionstate->visualizationuserid . '</userid>
</visualizationstate>';
        } else {
            echo '
  <on>0</on>
</visualizationstate>';
        }
    }
}
Esempio n. 14
0
 /**
  * Delete theme action
  */
 public function actionDelete()
 {
     // Check Access
     checkAccessThrowException('op_theme_delete');
     if (isset($_GET['id']) && ($model = Theme::model()->findByPk($_GET['id']))) {
         alog(at("Deleted Theme '{name}'.", array('{name}' => $model->name)));
         // Make sure its not default
         if ($model->dirname == getParam('default_theme')) {
             if (isAjax()) {
                 echoError(at('You can not delete the default theme.'));
             } else {
                 echoError(at('You can not delete the default theme.'));
             }
         }
         // Make sure its not public
         if ($model->is_active) {
             if (isAjax()) {
                 echoError(at('You can not delete an active theme.'));
             } else {
                 echoError(at('You can not delete an active theme.'));
             }
         }
         $model->delete();
         fok(at('Theme Deleted.'));
         $this->redirect(array('themes/index'));
     } else {
         $this->redirect(array('themes/index'));
     }
 }