Example #1
0
/**
 * admin_get_settings
 * 
 * 
 * 
 */
function admin_get_settings()
{
    $conn = reader_connect();
    $query = "\tSELECT * FROM settings";
    $result = $conn->query($query);
    $data = array();
    while ($row = $result->fetch_assoc()) {
        $row = stripslashes_deep($row);
        $element = strtolower($row['element_name']);
        $data[$element][] = $row;
    }
    return $data;
}
/**
 * get_article_attachments
 * 
 * 
 * 
 * 
 * 
 * 
 */
function get_article_attachments($id)
{
    if (empty($id)) {
        return false;
    }
    $conn = reader_connect();
    $query = "SELECT \r\n\t\t\t\t\tattachments.id, attachments.title, attachments.filename,\r\n\t\t\t\t\tattachments.ext, attachments.size, attachments.mime\r\n\t\t\t\tFROM attachments_map\r\n\t\t\t\t\tLEFT JOIN attachments ON attachments.id = attachments_map.attachment_id\r\n\t\t\t\tWHERE article_id = " . (int) $id;
    $result = $conn->query($query);
    $data = array();
    while ($row = $result->fetch_assoc()) {
        $row['itunes_link'] = WW_WEB_ROOT . '/download/' . $row['ext'] . '/' . $row['filename'];
        $row['file_link'] = WW_WEB_ROOT . '/ww_files/attachments/' . $row['ext'] . '/' . $row['filename'];
        $row['link'] = WW_WEB_ROOT . '/download/' . $row['id'] . '/';
        $data[] = $row;
    }
    return $data;
}
/**
 * get_link
 * 
 * 
 * 
 * 
 * 
 * 
 */
function get_link($link_id)
{
    if (empty($link_id)) {
        return false;
    }
    $conn = reader_connect();
    $query = "SELECT * FROM links WHERE id = " . (int) $link_id;
    $result = $conn->query($query);
    $row = $result->fetch_assoc();
    return stripslashes_deep($row);
}
/**
 * get_attachment
 * 
 * 
 * 
 * 
 * 
 * 
 */
function get_attachment($id)
{
    if (empty($id)) {
        return false;
    }
    $conn = reader_connect();
    $query = "SELECT \n\t\t\t\t\ttitle, filename, ext, size, mime\n\t\t\t\tFROM attachments\n\t\t\t\tWHERE id = " . (int) $id;
    $result = $conn->query($query);
    $data = array();
    $row = $result->fetch_assoc();
    return $row;
}