Пример #1
0
function cpgUserLastComment($uid)
{
    global $CONFIG;
    $result = cpg_db_query("SELECT count(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid AND approval='YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}");
    $nbEnr = mysql_fetch_array($result);
    $comment_count = $nbEnr[0];
    $lastcom_id = $nbEnr[1];
    mysql_free_result($result);
    $lastcom = '';
    if ($comment_count) {
        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body, approval " . "FROM {$CONFIG['TABLE_COMMENTS']} AS c, {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE msg_id='" . $lastcom_id . "' AND approval = 'YES' AND c.pid = p.pid";
        $result = cpg_db_query($sql);
        if (mysql_num_rows($result)) {
            $row = mysql_fetch_array($result);
            mysql_free_result($result);
            $pic_url = get_pic_url($row, 'thumb');
            if (!is_image($row['filename'])) {
                $image_info = cpg_getimagesize(urldecode($pic_url));
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            $mime_content = cpg_get_type($row['filename']);
            $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
        }
    }
    $lastComArray = array();
    $lastComArray['thumb'] = $lastcom;
    $lastComArray['comment'] = $row['msg_body'];
    $lastComArray['msg_date'] = $row['msg_date'];
    $lastComArray['count'] = $comment_count;
    return $lastComArray;
}
Пример #2
0
function quick_tag_page_html($html)
{
    global $CONFIG;
    $num_keywords = 10;
    $keywords_array = array();
    $keyword_count = array();
    $result = cpg_db_query("SELECT keywords FROM {$CONFIG['TABLE_PICTURES']} WHERE keywords <> ''");
    if (mysql_num_rows($result)) {
        while (list($keywords) = mysql_fetch_row($result)) {
            $array = explode($CONFIG['keyword_separator'], html_entity_decode($keywords));
            foreach ($array as $word) {
                if (!trim($word)) {
                    continue;
                }
                if (!in_array($word = utf_strtolower($word), $keywords_array)) {
                    $keywords_array[] = $word;
                    $keyword_count[$word] = 1;
                } else {
                    $keyword_count[$word]++;
                }
            }
        }
        arsort($keyword_count);
    }
    $i = 0;
    $buttons = '';
    foreach ($keyword_count as $keyword => $count) {
        if ($i++ >= $num_keywords) {
            break;
        }
        $buttons .= "<span class=\"admin_menu\" style=\"white-space: nowrap;\" onclick=\"jQuery('#keywords\\1').focus(); jQuery('#keywords\\1').val(jQuery('#keywords\\1').val() + '{$CONFIG['keyword_separator']}{$keyword}{$CONFIG['keyword_separator']}');\">{$keyword}</span> ";
    }
    $html = preg_replace('/<input type="text" style="width: 100%" name="keywords([0-9]+)?".* \\/>/U', "\\0<p></p>" . $buttons, $html);
    return $html;
}
Пример #3
0
function album_share_codes_main()
{
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->testInt('album')) {
        global $CONFIG;
        $aid = $superCage->get->getInt('album');
        $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '{$aid}'");
        if (mysql_num_rows($result) > 0) {
            while ($row = mysql_fetch_assoc($result)) {
                $url = $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $row['pid'];
                $thumb = $CONFIG['ecards_more_pic_target'] . get_pic_url($row, 'thumb');
                $content1 .= '[url=' . $url . '][img]' . $thumb . '[/img][/url]' . "\n";
                $content2 .= '<a href="' . $url . '"><img src="' . $thumb . ' /></a>' . "\n";
            }
            starttable(-1, 'Share codes for <i>all files</i> in this album');
            echo <<<EOT
                <tr>
                    <td class="tableb">
                        <tt>[url][img][/url]</tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content1}</textarea>
                        <br />
                        <tt>&lt;a&gt;&lt;img&gt;&lt;/a&gt;</tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content2}</textarea>
                    </td>
                </tr>
EOT;
            endtable();
        }
    }
}
Пример #4
0
/**
 * alb_get_subcat_data()
 *
 * @param integer $parent
 * @param string $ident
 **/
function alb_get_subcat_data($parent, $ident = '')
{
    global $CONFIG, $CAT_LIST, $USER_DATA;
    // select cats where the users can change the albums
    $groups = '';
    foreach ($USER_DATA['groups'] as $group) {
        $groups .= "group_id = '{$group}' OR ";
    }
    $groups .= "0";
    $result = cpg_db_query("SELECT cid, name, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '{$parent}' AND cid != 1 ORDER BY pos");
    if ($result->numRows() > 0) {
        $rowset = cpg_db_fetch_rowset($result);
        foreach ($rowset as $subcat) {
            if (!GALLERY_ADMIN_MODE) {
                $check_group = cpg_db_query("SELECT group_id FROM {$CONFIG['TABLE_CATMAP']} WHERE ({$groups}) AND cid = " . $subcat['cid']);
                $check_group_rowset = cpg_db_fetch_rowset($check_group);
                if ($check_group_rowset) {
                    $CAT_LIST[] = array($subcat['cid'], $ident . $subcat['name']);
                }
            } else {
                $CAT_LIST[] = array($subcat['cid'], $ident . $subcat['name']);
            }
            alb_get_subcat_data($subcat['cid'], $ident . '&nbsp;&nbsp;&nbsp;');
        }
    }
}
Пример #5
0
function create_hist_table()
{
    global $CONFIG;
    $tabname = $CONFIG['TABLE_PREFIX'] . "fullsize_hist";
    $query = "CREATE TABLE IF NOT EXISTS " . $tabname . " (" . "`id` int(10) unsigned NOT NULL auto_increment," . "`uid` int(10) unsigned NOT NULL default '0'," . "`tstamp` datetime NOT NULL default '0000-00-00 00:00:00'," . "`picname` varchar(255) NOT NULL default ''," . "`ip` varchar(20) NOT NULL default ''," . "PRIMARY KEY  (`id`)," . "UNIQUE KEY `multi` (`uid`,`picname`)" . ") ENGINE=MyISAM";
    cpg_db_query($query);
}
Пример #6
0
 function photo_shop_fetch_user($oid)
 {
     global $CONFIG, $udb_var;
     $sql = "SELECT s.*, u.{$udb_var['field']['username']}, u.{$udb_var['field']['email']}  FROM {$CONFIG['TABLE_SHOP']} AS s LEFT JOIN {$udb_var['usertable']} as u ON u.{$udb_var['field']['user_id']} = s.uid WHERE oid=" . $oid . " AND cd=1 AND s.uid=" . USER_ID . " LIMIT 1";
     $result = cpg_db_query($sql, $this->link_id);
     return $result;
 }
Пример #7
0
function cpgUserLastComment($uid)
{
    global $CONFIG, $FORBIDDEN_SET;
    $result = cpg_db_query("SELECT COUNT(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE approval = 'YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}");
    list($comment_count, $lastcom_id) = mysql_fetch_row($result);
    mysql_free_result($result);
    $lastComArray = array('count' => 0);
    if ($comment_count) {
        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE msg_id = {$lastcom_id}";
        $result = cpg_db_query($sql);
        if (mysql_num_rows($result)) {
            $row = mysql_fetch_assoc($result);
            $pic_url = get_pic_url($row, 'thumb');
            if (!is_image($row['filename'])) {
                $image_info = cpg_getimagesize(urldecode($pic_url));
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
            $lastComArray = array('thumb' => $lastcom, 'comment' => $row['msg_body'], 'msg_date' => $row['msg_date'], 'count' => $comment_count);
        }
        mysql_free_result($result);
    }
    return $lastComArray;
}
Пример #8
0
 function getDateLink($day, $month, $year)
 {
     global $CONFIG, $lang_calendar_php;
     $superCage = Inspekt::makeSuperCage();
     $date = sprintf('%s-%02s-%02s', $year, $month, $day);
     $query = "SELECT COUNT(pid) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND substring(from_unixtime(ctime),1,10) = '" . substr($date, 0, 10) . "' {$META_ALBUM_SET}";
     $result = cpg_db_query($query);
     $nb_pics = mysql_result($result, 0, 0);
     if ($matches = $superCage->get->getMatched('action', '/^[a-z]+$/')) {
         $action = $matches[0];
     } elseif ($matches = $superCage->post->getMatched('action', '/^[a-z]+$/')) {
         $action = $matches[0];
     } else {
         $action = '';
     }
     if ($action == 'browsebydate') {
         if ($nb_pics) {
             $link = '<a href="#" onclick="sendDate(\'' . $month . '\', \'' . $day . '\', \'' . $year . '\');" class="user_thumb_infobox"  title="' . $nb_pics . ' ' . $lang_calendar_php['files'] . '">';
         } else {
             $link = '';
         }
     } else {
         $link = "<a href=\"#\" onclick=\"sendDate('" . $month . "', '" . $day . "', '" . $year . "');\" class=\"user_thumb_infobox\" >";
     }
     return $link;
 }
Пример #9
0
function plugin_dst_datetime_update($dst_array)
{
    global $CONFIG;
    foreach ($dst_array as $value) {
        if ($CONFIG['plugin_dst_country'] == $value['country']) {
            $datetime = date('Y-m-d H:i:s');
            $previoustime = '';
            foreach ($value['data'] as $selected_array) {
                $starttime = current($selected_array);
                $endtime = next($selected_array);
                if ($datetime >= $starttime && $datetime <= $endtime) {
                    // We have a winner - it's currently DST and we have a time zone difference
                    $CONFIG['plugin_dst_datetime'] = $endtime;
                    $CONFIG['plugin_dst_on'] = '1';
                } elseif ($datetime > $previoustime && $datetime < $starttime) {
                    // We're out of the DST time range, i.e. in winter on the norther hemisphere
                    $CONFIG['plugin_dst_datetime'] = $starttime;
                    $CONFIG['plugin_dst_on'] = '0';
                }
                $previoustime = $endtime;
            }
            cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_dst_datetime']}' WHERE name='plugin_dst_datetime'");
            cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_dst_on']}' WHERE name='plugin_dst_on'");
        }
    }
}
Пример #10
0
function minicms($content = '')
{
    global $MINICMS, $CONFIG, $cat, $album, $REFERER, $lang_minicms, $HTML_SUBST_DECODE, $cms_array;
    if ($MINICMS['dbver'] != MINICMS_DBVER) {
        echo "<h2>{$lang_minicms['minicms_full']} {$MINICMS['dbver']}</h2><br />{$lang_minicms['dbver_nomatch']}: " . MINICMS_DBVER . "<br />";
        minicms_configure(false);
        //auto-updater and dont print the "go" button
    }
    $where = isset($MINICMS['ID']) ? "ID='{$MINICMS['ID']}'" : "conid='{$MINICMS['conid']}' AND type='{$MINICMS['type']}'";
    $query = "SELECT * FROM {$CONFIG['TABLE_CMS']} WHERE {$where} ORDER BY cpos";
    $result = cpg_db_query($query);
    $cms_array = cpg_db_fetch_rowset($result);
    $counter = 0;
    foreach ($cms_array as $key => $cms) {
        $cms_array[$key]['next_ID'] = $counter < count($cms_array) - 1 && $cms['type'] == $cms_array[$counter + 1]['type'] && $cms['conid'] == $cms_array[$counter + 1]['conid'] ? '&amp;id2=' . $cms_array[$counter + 1]['ID'] : '';
        $cms_array[$key]['prev_ID'] = $counter > 0 && $cms['type'] == $cms_array[$counter - 1]['type'] && $cms['conid'] == $cms_array[$counter - 1]['conid'] ? '&amp;id2=' . $cms_array[$counter - 1]['ID'] : '';
        $cms_array[$key]['content'] = html_entity_decode(stripslashes($cms['content']));
        $counter++;
    }
    ob_start();
    theme_minicms($cms_array);
    //$content.=ob_get_clean();
    $content = ob_get_clean();
    return $content;
}
Пример #11
0
function edit_pic_views_after_edit_file($pid)
{
    global $CONFIG;
    $hits = get_post_var('hits', $pid);
    if (is_numeric($hits) && $hits >= 0) {
        cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET hits = '{$hits}' WHERE pid = {$pid} LIMIT 1");
    }
}
Пример #12
0
function check_files_uninstall()
{
    global $CONFIG;
    cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_PREFIX']}plugin_check_files_additional");
    cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_PREFIX']}plugin_check_files_dirs");
    cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_PREFIX']}plugin_check_files_missing");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name LIKE 'plugin_check_files_%'");
    return true;
}
Пример #13
0
function exif_parse_file($filename)
{
    global $CONFIG, $lang_picinfo;
    //String containing all the available exif tags.
    $exif_info = "AFFocusPosition|Adapter|ColorMode|ColorSpace|ComponentsConfiguration|CompressedBitsPerPixel|Contrast|CustomerRender|DateTimeOriginal|DateTimedigitized|DigitalZoom|DigitalZoomRatio|ExifImageHeight|ExifImageWidth|ExifInteroperabilityOffset|ExifOffset|ExifVersion|ExposureBiasValue|ExposureMode|ExposureProgram|ExposureTime|FNumber|FileSource|Flash|FlashPixVersion|FlashSetting|FocalLength|FocusMode|GainControl|IFD1Offset|ISOSelection|ISOSetting|ISOSpeedRatings|ImageAdjustment|ImageDescription|ImageSharpening|LightSource|Make|ManualFocusDistance|MaxApertureValue|MeteringMode|Model|NoiseReduction|Orientation|Quality|ResolutionUnit|Saturation|SceneCaptureMode|SceneType|Sharpness|Software|WhiteBalance|YCbCrPositioning|xResolution|yResolution";
    if (!is_readable($filename)) {
        return false;
    }
    $size = @getimagesize($filename);
    if ($size[2] != 2) {
        return false;
    }
    // Not a JPEG file
    $exifRawData = explode("|", $exif_info);
    $exifCurrentData = explode("|", $CONFIG['show_which_exif']);
    //Let's build the string of current exif values to be shown
    $showExifStr = "";
    foreach ($exifRawData as $key => $val) {
        if ($exifCurrentData[$key] == 1) {
            $showExifStr .= "|" . $val;
        }
    }
    //Check if we have the data of the said file in the table
    $sql = "SELECT * FROM {$CONFIG['TABLE_EXIF']} " . "WHERE filename='" . addslashes($filename) . "'";
    $result = cpg_db_query($sql);
    if (mysql_num_rows($result) > 0) {
        $row = mysql_fetch_array($result);
        mysql_free_result($result);
        $exifRawData = unserialize($row["exifData"]);
    } else {
        // No data in the table - read it from the image file
        $exifRawData = read_exif_data_raw($filename, 0);
        // Insert it into table for future reference
        $sql = "INSERT INTO {$CONFIG['TABLE_EXIF']} " . "VALUES ('" . addslashes($filename) . "', '" . addslashes(serialize($exifRawData)) . "')";
        $result = cpg_db_query($sql);
    }
    $exif = array();
    if (is_array($exifRawData['IFD0'])) {
        $exif = array_merge($exif, $exifRawData['IFD0']);
    }
    if (is_array($exifRawData['SubIFD'])) {
        $exif = array_merge($exif, $exifRawData['SubIFD']);
    }
    if (is_array($exifRawData['SubIFD']['MakerNote'])) {
        $exif = array_merge($exif, $exifRawData['SubIFD']['MakerNote']);
    }
    $exif['IFD1OffSet'] = $exifRawData['IFD1OffSet'];
    $exifParsed = array();
    foreach ($exif as $key => $val) {
        if (strpos($showExifStr, "|" . $key) && isset($val)) {
            $exifParsed[$lang_picinfo[$key]] = $val;
            //$exifParsed[$key] = $val;
        }
    }
    ksort($exifParsed);
    return $exifParsed;
}
Пример #14
0
function cpgpicdownload_configure()
{
    global $CONFIG;
    if (!isset($CONFIG['cpgpicdownload'])) {
        $setting = 'anonymous';
        $sql = "INSERT INTO {$CONFIG['TABLE_CONFIG']} VALUES ('cpgpicdownload','{$setting}');";
        $CONFIG['cpgpicdownload'] = $setting;
        cpg_db_query($sql);
    }
}
Пример #15
0
function iframe_upload_uninstall()
{
    global $CONFIG;
    $CONFIG['allowed_doc_types'] = str_replace('/iframe', $CONFIG['allowed_doc_types']);
    $CONFIG['allowed_doc_types'] = str_replace('iframe/', '', $CONFIG['allowed_doc_types']);
    $CONFIG['allowed_doc_types'] = str_replace('iframe', '', $CONFIG['allowed_doc_types']);
    cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '{$CONFIG['allowed_doc_types']}' WHERE name = 'allowed_doc_types'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_FILETYPES']} WHERE extension = 'iframe'");
    return true;
}
Пример #16
0
function auto_tag_after_edit_file($pid)
{
    global $CONFIG;
    static $keywords_array = null;
    if ($keywords_array === null) {
        $keywords_array = array();
        $result = cpg_db_query("SELECT keywords FROM {$CONFIG['TABLE_PICTURES']} WHERE keywords <> ''");
        if (mysql_num_rows($result)) {
            while (list($keywords) = mysql_fetch_row($result)) {
                $array = explode($CONFIG['keyword_separator'], html_entity_decode($keywords));
                foreach ($array as $word) {
                    if (!in_array($word = utf_strtolower($word), $keywords_array) && trim($word)) {
                        $keywords_array[] = $word;
                    }
                }
            }
        }
    }
    if (!count($keywords_array)) {
        return;
    }
    $result = cpg_db_query("SELECT title, caption, keywords FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = {$pid} LIMIT 1");
    if (!mysql_num_rows($result)) {
        return;
    }
    $picture = mysql_fetch_assoc($result);
    if (!$picture['title'] && !$picture['caption']) {
        return;
    }
    preg_match_all('/[\\w]+/', $picture['title'], $matches_title);
    preg_match_all('/[\\w]+/', $picture['caption'], $matches_caption);
    $word_array = array_merge($matches_title[0], $matches_caption[0]);
    if ($picture['keywords']) {
        $keyword_array = array();
        $keyword_array_lowercase = array();
        $array = explode($CONFIG['keyword_separator'], html_entity_decode($picture['keywords']));
        foreach ($array as $word) {
            if (!in_array(utf_strtolower($word), $keyword_array_lowercase) && trim($word)) {
                $keyword_array[] = $word;
                $keyword_array_lowercase[] = utf_strtolower($word);
            }
        }
    }
    $new_keyword = false;
    foreach ($word_array as $word) {
        if (!in_array(utf_strtolower($word), $keyword_array_lowercase) && in_array(utf_strtolower($word), $keywords_array)) {
            $new_keyword = true;
            $keyword_array[] = $word;
            $keyword_array_lowercase[] = utf_strtolower($word);
        }
    }
    if ($new_keyword) {
        cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET keywords = '" . implode($CONFIG['keyword_separator'], $keyword_array) . "' WHERE pid = {$pid} LIMIT 1");
    }
}
Пример #17
0
/**
 * create_banlist()
 *
 * @return
 **/
function create_banlist()
{
    global $CONFIG, $lang_banning_php, $album_date_fmt;
    //$PHP_SELF,
    $result = cpg_db_query("SELECT *, UNIX_TIMESTAMP(expiry) AS expiry FROM {$CONFIG['TABLE_BANNED']} WHERE brute_force=0");
    $count = mysql_num_rows($result);
    if ($count > 0) {
        echo <<<EOHEAD
                <tr>
                <th align="center" class="tableh2">{$lang_banning_php['user_name']}</th>
                <th align="center" class="tableh2">{$lang_banning_php['ip_address']}</th>
                <th align="center" class="tableh2">{$lang_banning_php['expiry']}</th>
                <th align="center" class="tableh2"></th>
                </tr>
EOHEAD;
        $row_counter = 0;
        while ($row = mysql_fetch_array($result)) {
            if ($row['user_id']) {
                $username = get_username($row['user_id']);
            } else {
                $username = '';
            }
            if ($row['expiry']) {
                $expiry = localised_date($row['expiry'], '%Y-%m-%d');
            } else {
                $expiry = '';
            }
            echo <<<EOROW
                                        <tr>
                                               <form action="{$_SERVER['PHP_SELF']}" method="post" name="banlist{$row_counter}">
                                                     <td width="20%" class="tableb" valign="middle">
                                                             <input type="hidden" name="ban_id" value="{$row['ban_id']}" />
                                                <input type="text" class="textinput" style="width: 100%" name="edit_ban_user_name" value="{$username}" />
                                        </td>
                                                <td class="tableb" valign="middle">
                                                <input type="text" class="textinput" size="15" name="edit_ban_ip_addr" value="{$row['ip_addr']}" />
                                        </td>
                                                <td class="tableb" valign="middle">
                                                <input type="text" class="listbox_lang" size="20" name="edit_ban_expires" value="{$expiry}" readonly="readonly" title="{$lang_banning_php['select_date']}" />
                                                <a href="javascript:;"  onclick="return getCalendar(document.banlist{$row_counter}.edit_ban_expires);" title="{$lang_banning_php['select_date']}"><img src="images/calendar.gif" width="16" height="16" border="0" alt="" /></a>
                                        </td>
                                        <td class="tableb" valign="middle">
                                                                <input type="submit" class="button" name="edit_ban" value="{$lang_banning_php['edit_ban']}" />
                                        &nbsp;&nbsp;
                                                                <input type="submit" class="button" name="delete_ban" value="{$lang_banning_php['delete_ban']}" />
                                        </td>
                                </form>
                                </tr>
EOROW;
            $row_counter++;
        }
    }
    mysql_free_result($result);
}
Пример #18
0
function log_fullsize_access_fullsize_html($fullsize_html)
{
    global $CONFIG, $pid, $USER_DATA;
    if ($pid) {
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_PREFIX']}plugin_log_fullsize_access (pid, user_id, timestamp) VALUES ('{$pid}', '" . USER_ID . "', UNIX_TIMESTAMP())");
        if ($CONFIG['plugin_log_fullsize_access_email']) {
            preg_match('/alt="(.*)"/U', $fullsize_html, $matches);
            cpg_mail($CONFIG['gallery_admin_email'], 'Fullsize access', $USER_DATA['user_name'] . "\t" . $matches[1]);
        }
    }
    return $fullsize_html;
}
Пример #19
0
function plugin_geoip_uninstall()
{
    global $CONFIG;
    $superCage = Inspekt::makeSuperCage();
    if (!checkFormToken()) {
        global $lang_errors;
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    // Delete the plugin config records
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_geoip_scope'");
    return true;
}
Пример #20
0
function hs_uninstall()
{
    global $CONFIG, $thisplugin;
    if (!isset($_POST['drop'])) {
        return 1;
    }
    if ($_POST['drop']) {
        cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_HIGHSLIDE_CONFIG']}");
        cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name='highslide_enable';");
    }
    return true;
}
Пример #21
0
function get_album_data($category, $ident)
{
    global $CONFIG, $catStr, $ALBUM_SET;
    $sql = "SELECT aid,title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = {$category} " . $ALBUM_SET;
    $result = cpg_db_query($sql);
    if (($cat_count = mysql_num_rows($result)) > 0) {
        $rowset = cpg_db_fetch_rowset($result);
        foreach ($rowset as $subcat) {
            $catStr .= "\n  {$ident}<album>\n    {$ident}<id>{$subcat['aid']}</id>\n    {$ident}<name>{$subcat['title']}</name>\n  {$ident}</album>";
        }
    }
}
Пример #22
0
/**
 * alb_get_subcat_data()
 *
 * @param integer $parent
 * @param string $ident
 **/
function alb_get_subcat_data($parent, $ident = '')
{
    global $CONFIG, $CAT_LIST;
    $result = cpg_db_query("SELECT cid, name, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '{$parent}' AND cid != 1 ORDER BY pos");
    if (mysql_num_rows($result) > 0) {
        $rowset = cpg_db_fetch_rowset($result);
        foreach ($rowset as $subcat) {
            $CAT_LIST[] = array($subcat['cid'], $ident . $subcat['name']);
            alb_get_subcat_data($subcat['cid'], $ident . '&nbsp;&nbsp;&nbsp;');
        }
    }
}
Пример #23
0
 function session_extraction()
 {
     $row = false;
     //array('id' => 0, 'username' => 'Guest', 'status' => -1);
     if (isset($_COOKIE[$this->cookie_name])) {
         list($username, $pass_hash) = unserialize($_COOKIE[$this->cookie_name]);
         if (strcasecmp($username, 'Guest')) {
             $result = cpg_db_query("SELECT id, username, status+100 AS status FROM {$this->usertable} WHERE username = '******' AND password = '******'", $this->link_id);
             $row = mysql_fetch_assoc($result);
         }
     }
     return $row;
 }
Пример #24
0
function panorama_viewer_is_360_degree_panorama()
{
    global $CONFIG, $CURRENT_PIC_DATA;
    if (!isset($CONFIG['plugin_panorama_viewer_360_degree'])) {
        $CONFIG['plugin_panorama_viewer_360_degree'] = '_360pano.jp';
        cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES ('plugin_panorama_viewer_360_degree', '{$CONFIG['plugin_panorama_viewer_360_degree']}')");
    }
    if (stripos($CURRENT_PIC_DATA['filename'], $CONFIG['plugin_panorama_viewer_360_degree']) !== false) {
        return true;
    } else {
        return false;
    }
}
Пример #25
0
 function panorama_viewer_save_config_value($name)
 {
     global $CONFIG;
     $superCage = Inspekt::makeSuperCage();
     $new_value = $superCage->post->getRaw($name);
     if (!isset($CONFIG[$name])) {
         cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES('{$name}', '{$new_value}')");
         $CONFIG[$name] = $new_value;
     } elseif ($new_value != $CONFIG[$name]) {
         cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '{$new_value}' WHERE name = '{$name}'");
         $CONFIG[$name] = $new_value;
     }
 }
Пример #26
0
 function session_extraction()
 {
     if (isset($_COOKIE['session_id'])) {
         $session_id = addslashes($_COOKIE['session_id']);
         $sql = "SELECT member_id , member_login_key FROM {$this->sessionstable} AS s INNER JOIN {$this->usertable} AS u ON s.member_id = u.id WHERE s.id = '{$session_id}'";
         $result = cpg_db_query($sql, $this->link_id);
         if (mysql_num_rows($result)) {
             $row = mysql_fetch_array($result);
             return $row;
         }
     } else {
         return false;
     }
 }
Пример #27
0
function avmaker_uninstall()
{
    global $CONFIG;
    if (!isset($_POST['drop'])) {
        return 1;
    }
    if ($_POST['drop']) {
        //remove - config
        cpg_db_query("DELETE FROM `{$CONFIG['TABLE_CONFIG']}` WHERE name = 'avmk_enabled' OR name = 'avmk_df_width' OR name = 'avmk_df_height' OR name = 'avmk_jpeg_quality' OR name = 'avmk_time';");
        // drop a table
        cpg_db_query("DROP TABLE `{$CONFIG['TABLE_PREFIX']}av_temp`;");
    }
    return true;
}
Пример #28
0
 function getDateLink($day, $month, $year)
 {
     global $CONFIG, $lang_calendar_php, $FORBIDDEN_SET;
     $date = sprintf('%d-%02d-%02d', $year, $month, $day);
     $sql = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE approved = 'YES' AND DATE(FROM_UNIXTIME(ctime)) = '{$date}' {$FORBIDDEN_SET}";
     $result = cpg_db_query($sql);
     list($nb_pics) = mysql_fetch_row($result);
     if ($nb_pics) {
         $link = '<a href="#" onclick="sendDate(\'' . $month . '\', \'' . $day . '\', \'' . $year . '\');" class="user_thumb_infobox" title="' . $nb_pics . ' ' . $lang_calendar_php['files'] . '">';
     } else {
         $link = '';
     }
     return $link;
 }
Пример #29
0
 function session_extraction()
 {
     $superCage = Inspekt::makeSuperCage();
     if ($superCage->cookie->keyExists('session_id')) {
         $session_id = $superCage->cookie->getEscaped('session_id');
         $sql = "SELECT member_id, member_login_key FROM {$this->sessionstable} AS s INNER JOIN {$this->usertable} AS u ON s.member_id = u.id WHERE s.id = '{$session_id}'";
         $result = cpg_db_query($sql, $this->link_id);
         if (mysql_num_rows($result)) {
             $row = mysql_fetch_row($result);
             return $row;
         }
     } else {
         return false;
     }
 }
Пример #30
0
 function session_extraction()
 {
     if (isset($_COOKIE[$this->cookie_name . '_sid'])) {
         $session_id = addslashes($_COOKIE[$this->cookie_name . '_sid']);
         $sql = "SELECT user_id, username, group_id FROM {$this->sessionstable} INNER JOIN {$this->usertable} ON session_user_id = user_id WHERE session_id='{$session_id}';";
         // AND session_user_id ='$cookie_id'"; (Maybe session_id is unique enough?)
         $result = cpg_db_query($sql, $this->link_id);
         if (mysql_num_rows($result)) {
             $row = mysql_fetch_array($result);
             return $row;
         } else {
             return false;
         }
     }
 }