Exemplo n.º 1
0
<?php

include_once 'data.php';
include_once 'functions.php';
session_write_close();
if (isset($_GET['file'])) {
    $_GET['file'] = intval($_GET['file']);
}
//DELETE BUTTON IN ITEMS VIEW
if (isset($_GET['delete']) && isset($_GET['file']) && isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
    database_connect(IL_DATABASE_PATH, 'library');
    $error = null;
    $error = delete_record($dbHandle, $_GET['file']);
    die($error);
}
if (isset($_GET['file'])) {
    // Fetch ids from cache in history.
    database_connect(IL_DATABASE_PATH, 'history');
    if ($_SESSION['orderby'] == 'id') {
        $result = $dbHandle->query("SELECT itemID FROM `" . $_SESSION['display_files'] . "` WHERE id<=(SELECT id FROM `" . $_SESSION['display_files'] . "` WHERE itemID=" . $_GET['file'] . ")+10 ORDER BY id DESC LIMIT 22");
    } else {
        $result = $dbHandle->query("SELECT itemID FROM `" . $_SESSION['display_files'] . "` WHERE id>=(SELECT id FROM `" . $_SESSION['display_files'] . "` WHERE itemID=" . $_GET['file'] . ")-10 LIMIT 22");
    }
    $export_files = array();
    if ($result) {
        $export_files = $result->fetchAll(PDO::FETCH_COLUMN);
    }
    $dbHandle = null;
}
//CHECK IF ITEM IS STILL IN LIST AFTER CHANGES AND RELOAD
if (isset($_GET['checkitem']) && isset($_GET['files'])) {
Exemplo n.º 2
0
function scorm_seq_set($what, $scoid, $userid, $attempt = 0, $value = 'true')
{
    $sco = scorm_get_sco($scoid);
    /// set passed activity to active or not
    if ($value == false) {
        delete_record('scorm_scoes_track', 'scoid', $scoid, 'userid', $userid, 'attempt', $attempt, 'element', $what);
    } else {
        scorm_insert_track($userid, $sco->scorm, $sco->id, 0, $what, $value);
    }
    // update grades in gradebook
    $scorm = get_record('scorm', 'id', $sco->scorm);
    scorm_update_grades($scorm, $userid, true);
}
Exemplo n.º 3
0
function databaseactions()
{
    global $_POST, $MM_editTable, $MM_fieldsStr, $MM_columnsStr, $MM_editRedirectUrl, $MM_editColumn, $MM_recordId;
    if ($_POST[MM_insert]) {
        $id = insert_record($MM_editTable, $MM_fieldsStr, $MM_columnsStr, $MM_editRedirectUrl);
    }
    if ($_POST[MM_update] & $_POST[MM_recordId]) {
        $id = update_record($MM_editTable, $MM_recordId, $MM_fieldsStr, $MM_columnsStr, $MM_editRedirectUrl);
    }
    if ($_POST[MM_delete] & $_POST[MM_recordId]) {
        delete_record($MM_editTable, $MM_recordId, $MM_editRedirectUrl);
    }
    return $id;
}
Exemplo n.º 4
0
<?php

include_once 'data.php';
include_once 'functions.php';
if (isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
    if (!empty($_POST['submit'])) {
        if (!isset($_POST['ids'])) {
            $_POST['ids'] = array();
        }
        echo '<div class="details alternating_row" style="font-weight:bold">Number of Deleted Duplicates:</div>' . '<div style="padding:4px 8px">' . count($_POST['ids']) . '</div>' . '<div style="padding:0 8px"><h3>Done.</h3></div>';
        // DELETE ITEMS
        database_connect($database_path, 'library');
        delete_record($dbHandle, $_POST['ids']);
        $dbHandle = null;
    } elseif (isset($_GET['find_duplicates']) && $_GET['find_duplicates'] == 'similar') {
        echo '<div class="details alternating_row" style="font-weight:bold">Possible Duplicates:</div>' . '<div style="padding:4px 8px"><input type="checkbox" style="visibility:hidden">' . '<span style="display:inline-block;margin-left:1em;width:4em">ID</span><span style="margin-left:1em">Title</span></div>';
        echo '<form action="duplicates.php" method="POST">';
        $duplicates_array = array();
        database_connect($database_path, 'library');
        $dbHandle->exec("PRAGMA cache_size = 200000");
        $dbHandle->exec("PRAGMA temp_store = MEMORY");
        $dbHandle->exec("PRAGMA synchronous = OFF");
        $dbHandle->exec("CREATE TEMPORARY TABLE search_result (id INTEGER PRIMARY KEY,title)");
        $dbHandle->exec("INSERT INTO search_result SELECT id,title FROM library");
        $result = $dbHandle->query("SELECT id,title FROM search_result ORDER BY id ASC");
        $i = 0;
        while ($title = $result->fetch(PDO::FETCH_ASSOC)) {
            $title_query = $dbHandle->quote(substr($title['title'], 0, -1) . '%');
            $id_result = $dbHandle->query("SELECT id,title FROM search_result WHERE id > {$title['id']} AND lower(title) LIKE lower({$title_query}) LIMIT 1");
            $id_result = $id_result->fetch(PDO::FETCH_ASSOC);
            if (!empty($id_result['id'])) {
Exemplo n.º 5
0
        $ret = delete_record($args);
        if ($ret !== true) {
            output_error($ret);
        }
        break;
    case '/add-record':
        $ret = add_record($args);
        if ($ret !== true) {
            output_error($ret);
        }
        break;
    case '/update-record':
        $original = $args['record']['original'];
        $new = $args['record']['new'];
        $args['record'] = $original;
        // output_error(print_r($args));
        $ret = delete_record($args);
        if ($ret !== true) {
            output_error($ret);
        }
        $args['record'] = $new;
        $ret = add_record($args);
        if ($ret !== true) {
            $args['record'] = $original;
            add_record($args);
            output_error($ret);
        }
        break;
    default:
        output_error('Requested method is not available.', 501);
}
Exemplo n.º 6
0
function delete_rhythm($rid)
{
    //Delete rhythm
    delete_record('rid', $rid, 'nsh_rhythms');
}
    $perm_content_edit = "own";
} else {
    $perm_content_edit = "none";
}
$zid = get_zone_id_from_record_id($_GET['id']);
if ($zid == NULL) {
    header("Location: list_zones.php");
    exit;
}
$user_is_zone_owner = verify_user_is_owner_zoneid($zid);
$zone_info = get_zone_info_from_id($zid);
if ($record_id == "-1") {
    error(ERR_INV_INPUT);
} else {
    if ($confirm == '1') {
        if (delete_record($record_id)) {
            success("<a href=\"edit.php?id=" . $zid . "\">" . SUC_RECORD_DEL . "</a>");
            /*
            update serial after record deletion
            */
            update_soa_serial($zid);
        }
    } else {
        $zone_id = recid_to_domid($record_id);
        $zone_name = get_zone_name_from_id($zone_id);
        $user_is_zone_owner = verify_user_is_owner_zoneid($zone_id);
        $record_info = get_record_from_id($record_id);
        echo "     <h2>" . _('Delete record in zone') . " \"<a href=\"edit.php?id=" . $zid . "\">" . $zone_name . "</a>\"</h2>\n";
        if ($zone_info['type'] == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0") {
            error(ERR_PERM_EDIT_RECORD);
        } else {
Exemplo n.º 8
0
            $dbHandle->exec("INSERT OR IGNORE INTO filescategories (fileID,categoryID) SELECT itemID, " . intval($cat) . " FROM history.`" . $_SESSION['display_files'] . "` ORDER BY id DESC");
        }
        $dbHandle->exec("DELETE FROM filescategories WHERE fileID NOT IN (SELECT id from library)");
    }
    // REMOVE FROM CATEGORIES
    if ($_POST['omnitool'] == '9' && !empty($_POST['category'])) {
        while (list(, $cat) = each($_POST['category'])) {
            $dbHandle->exec("DELETE FROM filescategories WHERE categoryID=" . intval($cat) . " AND fileID IN (SELECT itemID FROM history.`" . $_SESSION['display_files'] . "` ORDER BY id)");
        }
    }
    $dbHandle->commit();
    // DELETE ITEMS
    if ($_POST['omnitool'] == '8' && isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
        $result = $dbHandle->query("SELECT itemID FROM history.`" . $_SESSION['display_files'] . "` LIMIT 10000");
        $delete_files = $result->fetchAll(PDO::FETCH_COLUMN);
        delete_record($dbHandle, $delete_files);
    }
    $dbHandle = null;
} elseif (isset($_SESSION['auth'])) {
    ?>

    <div>
        <table class="threed" cellspacing=0 style="width:100%">
            <tr>
                <td class="threed select_span omnitooltd" style="width:32%;line-height:22px">
                    <input type="radio" style="display:none" name="omnitool" value="1">
                    &nbsp;<i class="fa fa-circle-o"></i>
                    Save to Shelf
                </td>
                <td class="threed select_span omnitooltd" style="width:32%;line-height:22px">
                    <input type="radio" style="display:none" name="omnitool" value="5">
Exemplo n.º 9
0
 // Create the final message.
 if ($PIC_NEED_APPROVAL) {
     if ($file_placement == 'no') {
         $final_message = '' . $lang_upload_php['no_place'] . '<br /><br />' . $lang_db_input_php['upload_success'];
     } else {
         $final_message = '' . $lang_upload_php['yes_place'] . '<br /><br />' . $lang_db_input_php['upload_success'];
     }
 } else {
     if ($file_placement == 'no') {
         $final_message = '' . $lang_upload_php['no_place'] . '<br /><br />' . $lang_upload_php['process_complete'];
     } else {
         $final_message = '' . $lang_upload_php['yes_place'] . '<br /><br />' . $lang_upload_php['process_complete'];
     }
 }
 // Delete the temporary data file.
 delete_record($_POST['unique_ID']);
 // Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
 if ($CONFIG['upl_notify_admin_email'] and $PIC_NEED_APPROVAL) {
     // Encapsulate so included lang file doesn't interfere with global one
     function cpg_send_upload_notification()
     {
         global $CONFIG;
         $lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
         // Get the mail files.
         include_once 'include/mailer.inc.php';
         // Send the message.
         cpg_mail('admin', sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME, $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . 'editpics.php?mode=upload_approval'));
     }
     cpg_send_upload_notification();
 }
 // That was the last one. Create a redirect box.
Exemplo n.º 10
0
function ewiki_database_moodle($action, &$args, $sw1, $sw2)
{
    global $wiki, $wiki_entry, $CFG;
    #-- result array
    $r = array();
    switch ($action) {
        /*  Returns database entry as array for the page whose name was given
                with the "id" key in the $args array, usually fetches the latest
                version of a page, unless a specific "version" was requested in
                the $args array.
            */
        # Ugly, but we need to choose which wiki we are about to change/read
        case "GET":
            $id = "'" . anydb_escape_string($args["id"]) . "'";
            $version = 0 + @$args["version"] and $version = "AND (version={$version})" or $version = "";
            # $result = mysql_query("SELECT * FROM " . EWIKI_DB_TABLE_NAME
            #   . " WHERE (pagename=$id) $version  ORDER BY version DESC  LIMIT 1"
            #);
            #if ($result && ($r = mysql_fetch_array($result, MYSQL_ASSOC))) {
            #   $r["id"] = $r["pagename"];
            #   unset($r["pagename"]);
            #}
            #if (strlen($r["meta"])) {
            #   $r["meta"] = @unserialize($r["meta"]);
            #}
            $select = "(pagename={$id}) AND wiki=" . $wiki_entry->id . "  {$version} ";
            $sort = "version DESC";
            if ($result_arr = get_records_select(EWIKI_DB_TABLE_NAME, $select, $sort, "*", 0, 1)) {
                //Iterate to get the first (and unique!)
                foreach ($result_arr as $obj) {
                    $result_obj = $obj;
                }
            }
            if ($result_obj) {
                //Convert to array
                $r = get_object_vars($result_obj);
                $r["id"] = $r["pagename"];
                unset($r["pagename"]);
                $r["meta"] = @unserialize($r["meta"]);
            }
            break;
            /*  Increases the hit counter for the page name given in $args array
                    with "id" index key.
                */
        /*  Increases the hit counter for the page name given in $args array
                with "id" index key.
            */
        case "HIT":
            #mysql_query("UPDATE " . EWIKI_DB_TABLE_NAME . " SET hits=(hits+1) WHERE pagename='" . anydb_escape_string($args["id"]) . "'");
            # set_field does not work because of the "hits+1" construct
            #print "DO ".anydb__escape_string($args["id"]); exit;
            execute_sql("UPDATE " . $CFG->prefix . EWIKI_DB_TABLE_NAME . " SET hits=(hits+1) WHERE pagename='" . anydb_escape_string($args["id"]) . "' and wiki=" . $wiki_entry->id, 0);
            break;
            /*  Stores the $data array into the database, while not overwriting
                    existing entries (using WRITE); returns 0 on failure and 1 if
                    saved correctly.
                */
        /*  Stores the $data array into the database, while not overwriting
                existing entries (using WRITE); returns 0 on failure and 1 if
                saved correctly.
            */
        case "OVERWRITE":
            $COMMAND = "REPLACE";
            break;
        case "WRITE":
            $COMMAND = "WRITE";
            $args["pagename"] = $args["id"];
            unset($args["id"]);
            if (is_array($args["meta"])) {
                $args["meta"] = serialize($args["meta"]);
            }
            #$sql1 = $sql2 = "";
            #foreach ($args as $index => $value) {
            #   if (is_int($index)) {
            #      continue;
            #   }
            #   $a = ($sql1 ? ', ' : '');
            #   $sql1 .= $a . $index;
            #   $sql2 .= $a . "'" . anydb_escape_string($value) . "'";
            #}
            #strlen(@$COMMAND) || ($COMMAND = "INSERT");
            foreach ($args as $index => $value) {
                if (is_int($index)) {
                    continue;
                }
                $args[$index] = anydb_escape_string($value);
            }
            $args["wiki"] = $wiki_entry->id;
            # Check if Record exists
            if ($COMMAND == "REPLACE") {
                if (count_records(EWIKI_DB_TABLE_NAME, "wiki", $wiki_entry->id, "pagename", $args["pagename"], "version", $args["version"])) {
                    delete_record(EWIKI_DB_TABLE_NAME, "wiki", $wiki_entry->id, "pagename", $args["pagename"], "version", $args["version"]);
                }
            }
            # Write
            $result = insert_record(EWIKI_DB_TABLE_NAME, (object) $args, false);
            #$result = mysql_query("$COMMAND INTO " . EWIKI_DB_TABLE_NAME .
            #   " (" . $sql1 . ") VALUES (" . $sql2 . ")"
            #);
            #return($result && mysql_affected_rows() ?1:0);
            return $result;
            break;
            /*  Checks for existence of the WikiPages whose names are given in
                    the $args array. Returns an array with the specified WikiPageNames
                    associated with values of "0" or "1" (stating if the page exists
                    in the database). For images/binary db entries returns the "meta"
                    field instead of an "1".
                */
        /*  Checks for existence of the WikiPages whose names are given in
                the $args array. Returns an array with the specified WikiPageNames
                associated with values of "0" or "1" (stating if the page exists
                in the database). For images/binary db entries returns the "meta"
                field instead of an "1".
            */
        case "FIND":
            $select = "";
            foreach (array_values($args) as $id) {
                if (strlen($id)) {
                    $r[$id] = 0;
                    $select .= ($select ? " OR " : "") . "(pagename='" . anydb_escape_string($id) . "')";
                }
            }
            if ($select) {
                $select = "(" . $select . ") AND wiki=" . $wiki_entry->id;
                $result = get_records_select(EWIKI_DB_TABLE_NAME, $select);
                #$sql = "SELECT pagename AS id, meta FROM " .
                #   EWIKI_DB_TABLE_NAME . " WHERE $sql "
                #);
                #while ($result && ($row = mysql_fetch_row($result))) {
                #   $r[$row[0]] = strpos($row[1], 's:5:"image"') ? $row[1] : 1;
                while (list($key, $val) = @each($result)) {
                    $r[$val->pagename] = strpos($val->meta, 's:5:"image"') ? $val->meta : 1;
                }
            }
            break;
            /* Counts the number of Versions
             */
        /* Counts the number of Versions
         */
        case "COUNTVERSIONS":
            $sql = "SELECT pagename AS id, count(*) as versioncount" . " FROM " . $CFG->prefix . EWIKI_DB_TABLE_NAME . " WHERE wiki = " . $wiki_entry->id . " GROUP BY pagename";
            #print "$sql";
            $result = get_records_sql($sql);
            while (list($key, $val) = each($result)) {
                $r[$key] = $val->versioncount;
            }
            break;
            /*  Returns an array of the lastest versions of __all__ pages,
                    where each entry is made up of the fields from the database
                    requested with the $args array, e.g.
                    array("flags","meta","lastmodified");
                */
        /*  Returns an array of the lastest versions of __all__ pages,
                where each entry is made up of the fields from the database
                requested with the $args array, e.g.
                array("flags","meta","lastmodified");
            */
        case "GETALL":
            switch ($CFG->dbfamily) {
                case 'postgres':
                    // All but the latest version eliminated by DISTINCT
                    // ON (pagename)
                    $sql = "SELECT DISTINCT ON (pagename) pagename AS id, " . implode(", ", $args) . " FROM " . $CFG->prefix . EWIKI_DB_TABLE_NAME . " WHERE wiki = " . $wiki_entry->id . " ORDER BY pagename, version DESC";
                    break;
                case 'mysql':
                    // All but the latest version eliminated by
                    // mysql-specific GROUP BY-semantics
                    $sql = "SELECT pagename AS id, " . implode(", ", $args) . " FROM " . $CFG->prefix . EWIKI_DB_TABLE_NAME . " WHERE wiki = " . $wiki_entry->id . " GROUP BY id, version DESC ";
                default:
                    // All but the latest version are here eliminated in
                    // get_records_sql, since it will return an array
                    // with only one result per id-field value. Note,
                    // that for this to work the query needs to order the
                    // records ascending by version, so later versions
                    // will overwrite previous ones in
                    // recordset_to_array. This is not pretty.
                    $sql = "SELECT pagename AS id, " . implode(", ", $args) . " FROM " . $CFG->prefix . EWIKI_DB_TABLE_NAME . " WHERE wiki = " . $wiki_entry->id . " ORDER BY version";
            }
            $result = get_records_sql($sql);
            $r = new ewiki_dbquery_result($args);
            if ($result) {
                foreach ($result as $val) {
                    $r->add(get_object_vars($val));
                }
            }
            break;
            /*  Returns array of database entries (also arrays), where the one
                    specified column matches the specified content string, for example
                    $args = array("content" => "text...piece")
                    is not guaranteed to only search/return the latest version of a page
                */
        /*  Returns array of database entries (also arrays), where the one
                specified column matches the specified content string, for example
                $args = array("content" => "text...piece")
                is not guaranteed to only search/return the latest version of a page
            */
        case "SEARCH":
            $field = implode("", array_keys($args));
            $content = strtolower(implode("", $args));
            if ($field == "id") {
                $field = "pagename";
            }
            $sql = "SELECT pagename AS id, version, flags" . (EWIKI_DBQUERY_BUFFER && $field != "pagename" ? ", {$field}" : "") . " FROM " . $CFG->prefix . EWIKI_DB_TABLE_NAME . " WHERE {$field} " . sql_ilike() . " '%" . anydb_escape_string($content) . "%'  and wiki=" . $wiki_entry->id . " ORDER BY id, version ASC";
            $result = get_records_sql($sql);
            $r = new ewiki_dbquery_result(array("id", "version", $field));
            $drop = "";
            #while ($result && ($row = mysql_fetch_array($result, MYSQL_ASSOC))) {
            #   $i = EWIKI_CASE_INSENSITIVE ? strtolower($row["id"]) : $row["id"];
            #   if ($i != $drop) {
            #      $drop = $i;
            #      $r->add($row);
            #   }
            #}
            while (list($key, $val) = @each($result)) {
                $row = get_object_vars($val);
                $i = EWIKI_CASE_INSENSITIVE ? strtolower($row["id"]) : $row["id"];
                if ($i != $drop) {
                    $drop = $i;
                    $r->add($row);
                }
            }
            break;
        case "DELETE":
            $id = anydb_escape_string($args["id"]);
            $version = $args["version"];
            #mysql_query("DELETE FROM " . EWIKI_DB_TABLE_NAME ."
            #   WHERE pagename='$id' AND version=$version");
            # print "DELETING wiki:".$wiki_entry->id."Pagename: $id Version: $version <br />\n";
            delete_records(EWIKI_DB_TABLE_NAME, "wiki", $wiki_entry->id, "pagename", $id, "version", $version);
            break;
        case "INIT":
            #mysql_query("CREATE TABLE " . EWIKI_DB_TABLE_NAME ."
            #   (pagename VARCHAR(160) NOT NULL,
            #   version INTEGER UNSIGNED NOT NULL DEFAULT 0,
            #   flags INTEGER UNSIGNED DEFAULT 0,
            #   content MEDIUMTEXT,
            #   author VARCHAR(100) DEFAULT 'ewiki',
            #   created INTEGER UNSIGNED DEFAULT ".time().",
            #   lastmodified INTEGER UNSIGNED DEFAULT 0,
            #   refs MEDIUMTEXT,
            #   meta MEDIUMTEXT,
            #   hits INTEGER UNSIGNED DEFAULT 0,
            #   PRIMARY KEY id (pagename, version) )
            #   ");
            #echo mysql_error();
            break;
        default:
    }
    return $r;
}
Exemplo n.º 11
0
}
//DELETE ACTION
if (isset($_GET['delete'])) {
    $id = $_GET['delete'];
    //sementara delete data tanpa cek ke table lain karna ini cek ke tabel transaksi
    //CEK DATA IN other table BEFORE DELETE
    //	$cek_exist = count_data(TB_PREF."items", 'id', "id_brand='".$id."'");
    //	if ($cek_exist[0]>0) {
    //            display_error("Data ini masih digunakan... "
    //                    . "| <a href='?".$parameter_key."kd_tabel=tb_stores' />Close</a>");
    //	}
    //        else{
    $table = TB_PREF . "stores";
    $field_key = "id";
    $field_val = "'" . $id . "'";
    $query = delete_record($table, $field_key, $field_val);
    if ($query) {
        display_success("Data berhasil dihapus " . "| <a href='?" . $parameter_key . "kd_tabel=tb_stores' />Close</a>");
    } else {
        display_error("Gagal menghapus data <br>" . "(" . mysql_error() . ") | <a href='?" . $parameter_key . "kd_tabel=tb_stores' />Close</a>");
    }
    //	}
}
//-------------------------------FORM-----------------------------------------
start_form();
//form input
if (isset($_POST['AddNew'])) {
    start_table("class='form'");
    text_field('Store Name: ', 'store_name', $val_selected['store_name'], true);
    text_area('Description: ', 'description', $val_selected['description']);
    text_field('Address: ', 'address', $val_selected['address'], false);
Exemplo n.º 12
0
function udutu_seq_set($what, $scoid, $userid, $attempt = 0, $value = 'true')
{
    /// set passed activity to active or not
    if ($value == false) {
        delete_record('udutu_scoes_track', 'scoid', $scoid, 'userid', $userid, 'element', $what);
    } else {
        $sco = udutu_get_sco($scoid);
        udutu_insert_track($userid, $sco->udutu, $sco->id, 0, $what, $value);
    }
}
 function borrar_id($id)
 {
     delete_record('ejercicios_ierc_resp', 'id', $id);
 }
Exemplo n.º 14
0
 // Create the final message.
 if ($PIC_NEED_APPROVAL) {
     if ($file_placement == 'no') {
         $final_message = '' . $lang_upload_php['no_place'] . '<br /><br />' . $lang_db_input_php['upload_success'];
     } else {
         $final_message = '' . $lang_upload_php['yes_place'] . '<br /><br />' . $lang_db_input_php['upload_success'];
     }
 } else {
     if ($file_placement == 'no') {
         $final_message = '' . $lang_upload_php['no_place'] . '<br /><br />' . $lang_upload_php['process_complete'];
     } else {
         $final_message = '' . $lang_upload_php['yes_place'] . '<br /><br />' . $lang_upload_php['process_complete'];
     }
 }
 // Delete the temporary data file.
 delete_record($superCage->post->getAlnum('unique_ID'));
 // Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
 if ($CONFIG['upl_notify_admin_email'] and $PIC_NEED_APPROVAL) {
     // Encapsulate so included lang file doesn't interfere with global one
     function cpg_send_upload_notification()
     {
         global $CONFIG;
         $lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
         // Get the mail files.
         include_once 'include/mailer.inc.php';
         // Send the message.
         cpg_mail('admin', sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME, $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . 'editpics.php?mode=upload_approval'));
     }
     cpg_send_upload_notification();
 }
 // That was the last one. Create a redirect box.
}
foreach ($enrolledusers as $user) {
    $dataobj = new stdClass();
    $dataobj->userid = $user->id;
    $dataobj->hostid = $mnet_peer->id;
    $dataobj->courseid = $courseid;
    $dataobj->rolename = $all_enrolled_users[$user->username]['name'];
    $dataobj->enroltype = $all_enrolled_users[$user->username]['enrol'];
    if ($user->wehaverecord == 0) {
        $dataobj->enroltime = $all_enrolled_users[$user->username]['timemodified'];
        $dataobj->id = insert_record('mnet_enrol_assignments', $dataobj);
    } elseif (array_key_exists($user->username, $all_enrolled_users)) {
        $dataobj->id = $user->enrolid;
        update_record('mnet_enrol_assignments', $dataobj);
    } elseif (is_array($all_enrolled_users) && count($all_enrolled_users)) {
        delete_record('mnet_enrol_assignments', 'id', $user->enrolid);
    }
}
unset($enrolledusers);
// Read about our remote enrolments in 2 sets
// first, get the remote enrolments done via enrol/mnet      $mnetenrolledusers
// second, get the remote enrolments done with other plugins $remtenrolledusers
// NOTE: both arrays are keyed on the userid!
$sql = "\n            SELECT\n                u.id,\n                u.firstname,\n                u.lastname,\n                a.rolename,\n                a.enroltype,\n                a.courseid\n            FROM\n                {$CFG->prefix}user u,\n                {$CFG->prefix}mnet_enrol_assignments a\n            WHERE\n                a.userid = u.id AND \n                a.courseid={$courseid} AND\n                a.enroltype = 'mnet'   AND\n                u.deleted = 0 AND\n                u.confirmed = 1 AND\n                u.mnethostid = {$CFG->mnet_localhost_id}\n            ORDER BY\n                u.firstname ASC,\n                u.lastname ASC";
if (!($mnetenrolledusers = get_records_sql($sql))) {
    $mnetenrolledusers = array();
}
$sql = "\n            SELECT\n                u.id,\n                u.firstname,\n                u.lastname,\n                a.rolename,\n                a.enroltype,\n                a.courseid\n            FROM\n                {$CFG->prefix}user u,\n                {$CFG->prefix}mnet_enrol_assignments a\n            WHERE\n                a.userid = u.id AND \n                a.courseid={$courseid} AND\n                a.enroltype != 'mnet'  AND\n                u.deleted = 0 AND\n                u.confirmed = 1 AND\n                u.mnethostid = {$CFG->mnet_localhost_id}\n            ORDER BY\n                u.firstname ASC,\n                u.lastname ASC";
if (!($remtenrolledusers = get_records_sql($sql))) {
    $remtenrolledusers = array();
}
Exemplo n.º 16
0
             $show_insert_form_after_error = 1;
             $show_edit_form_after_error = 1;
             // display the form
             $form = build_form($table_name, $action, $fields_labels_ar, $form_type, $res_details, $where_field, $where_value, $show_insert_form_after_error, $show_edit_form_after_error);
             echo $form;
         }
         // end if
     }
     // end if
     break;
 case "delete":
     if ($enable_delete == "1") {
         // deletion of a record from a table, after the deletion we need to redirect to the show results mode
         $location_url = $site_url . $dadabik_main_file . '?table_name=' . urlencode($table_name) . '&function=search&where_clause=' . urlencode($where_clause);
         if ($enable_authentication === 0 || $enable_delete_authorization === 0 || current_user_is_owner($where_field, $where_value, $table_name, $fields_labels_ar)) {
             delete_record($table_name, $where_field, $where_value);
         } else {
             $location_url .= '&just_delete_no_authorization=1';
         }
         // end else
         header('Location: ' . $location_url);
         exit;
     }
     // end if
     break;
 case "delete_all":
     if ($enable_delete == "1" && $enable_delete_all_feature === 1) {
         $ID_user_field_name = get_ID_user_field_name($fields_labels_ar);
         delete_multiple_records($table_name, $where_clause, $ID_user_field_name);
         $location_url = $site_url . $dadabik_main_file . '?table_name=' . urlencode($table_name) . "&function=search&where_clause=&page=0";
         if ($enable_browse_authorization === 0 && $ID_user_field_name !== false) {
Exemplo n.º 17
0
    }
    // REMOVE FROM CATEGORIES
    if ($_POST['omnitool'] == '9' && !empty($_POST['category'])) {
        while (list(, $value) = each($export_files)) {
            $file_query = $dbHandle->quote($value);
            while (list(, $cat) = each($_POST['category'])) {
                print "DELETE FROM filescategories WHERE fileID={$file_query} AND categoryID=" . intval($cat);
                $dbHandle->exec("DELETE FROM filescategories WHERE fileID={$file_query} AND categoryID=" . intval($cat));
            }
            reset($_POST['category']);
        }
    }
    $dbHandle->commit();
    // DELETE ITEMS
    if ($_POST['omnitool'] == '8' && isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
        delete_record($dbHandle, $export_files);
    }
    $dbHandle = null;
} elseif (isset($_SESSION['auth'])) {
    ?>

    <div>
        <table class="threed" cellspacing=0 style="width:100%">
            <tr>
                <td class="threed select_span omnitooltd" style="width:32%;line-height:22px">
                    <input type="radio" style="display:none" name="omnitool" value="1">
                    &nbsp;<i class="fa fa-circle-o"></i>
                    Save to Shelf
                </td>
                <td class="threed select_span omnitooltd" style="width:32%;line-height:22px">
                    <input type="radio" style="display:none" name="omnitool" value="5">
Exemplo n.º 18
0
if (isset($_GET['clear_all_records'])) {
    global $wpdb;
    $db_table = DB_TABLE_WPWSL_HISTORY;
    $wpdb->query("delete from {$db_table}");
}
function delete_record($id)
{
    global $wpdb;
    $db_table = DB_TABLE_WPWSL_HISTORY;
    $wpdb->query("delete from {$db_table} where id='{$id}'");
}
if (isset($_GET['action']) && isset($_GET['action2'])) {
    if ($_GET['action'] == 'delete' || $_GET['action2'] == 'delete') {
        if (isset($_GET['record'])) {
            foreach ($_GET['record'] as $r) {
                delete_record($r);
            }
        }
    }
}
function results_order()
{
    $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : 'time';
    $order = !empty($_GET['order']) ? $_GET['order'] : 'desc';
    return $orderby . " " . $order;
}
$order = results_order();
$paged = isset($_GET['paged']) ? $_GET['paged'] : 1;
$start = ($paged - 1) * SELECT_ROWS_AMOUNT;
global $wpdb;
//history