コード例 #1
0
ファイル: bookmarks.php プロジェクト: noikiy/owaspbwa
function add_bookmark($uname, $title, $folderid, $url, $description, $tags = "", $newPublic = false, $date = NULL)
{
    $resultArr = array();
    $resultArr['success'] = false;
    include 'conn.php';
    require_once dirname(__FILE__) . '/protection.php';
    if ($date != "") {
        $date = "'{$date}'";
    } else {
        $date = "now()";
    }
    // Cut data to respect maximum length
    if (!empty($title)) {
        $title = substr($title, 0, 100);
    }
    if (!empty($description)) {
        $description = substr($description, 0, 150);
    }
    //$Query = sprintf("INSERT INTO " . TABLE_PREFIX . "favourites (Name , Title , FolderID , Url , Description, ADD_DATE) " . "values('" . $uname . "', %s,'" . $folderid . "', %s, %s, $date) ", quote_smart($title), quote_smart($url), quote_smart($description));
    $Query = "INSERT INTO " . TABLE_PREFIX . "favourites (Name , Title , FolderID , Url , Description, ADD_DATE) values(?, ?, ?, ?, ?, {$date})";
    $sth = $dblink->prepare($Query);
    $dataBookmark = array($uname, $title, $folderid, $url, $description);
    $AffectedRows = $sth->execute($dataBookmark);
    $rec_id = $dblink->lastInsertID(TABLE_PREFIX . "favourites", 'ID');
    if (PEAR::isError($AffectedRows)) {
        $resultArr['success'] = true;
        //echo 'ERROR: '. $AffectedRows->getMessage(). ' :: ' . $AffectedRows->getUserInfo();
    } else {
        $resultArr['success'] = true;
        $tags = trim($tags);
        if (TAGS && $tags != "") {
            require_once dirname(__FILE__) . '/tags_functions.php';
            //Remove any commas, dots, quotes, plus signs since the user might use commas to seperate tags rather than spaces
            $toRemove = array('"', "'", ",", "+");
            $tags = str_replace($toRemove, "", $tags);
            $tags = filter($tags);
            if ($tags != null && $newPublic) {
                // cut tags if too long > 150 chars
                $tags = substr($tags, 0, 150);
                //Add the tags
                addTags($tags);
                //Store the tags with the bookmark
                storeTags($rec_id, $tags);
            }
            if (USE_SCREENSHOT && CURL_AVAILABLE) {
                require_once dirname(__FILE__) . '/curl.php';
                $newc = new curl();
                $urlScreenshot = sprintf(SCREENSHOT_URL, $url);
                //echo $urlScreenshot;
                $fd = $newc->getFile($urlScreenshot);
            }
        }
    }
    return $resultArr;
}
コード例 #2
0
ファイル: class-album.php プロジェクト: JoniWeiss/JoniWebGirl
 /**
  * Copy this album to the location specified by $newfolder, copying all
  * metadata, subalbums, and subalbums' metadata with it.
  * @param $newfolder string the folder to copy to, including the name of the current folder (possibly renamed).
  * @return int 0 on success and error indicator on failure.
  *
  */
 function copy($newfolder)
 {
     // album name to destination folder
     if (substr($newfolder, -1, 1) != '/') {
         $newfolder .= '/';
     }
     $newfolder .= basename($this->localpath);
     // First, ensure the new base directory exists.
     $oldfolder = $this->name;
     $dest = ALBUM_FOLDER_SERVERPATH . internalToFilesystem($newfolder);
     // Check to see if the destination directory already exists
     if (file_exists($dest)) {
         // Disallow moving an album over an existing one.
         return 3;
     }
     if (substr($newfolder, count($oldfolder)) == $oldfolder) {
         // Disallow copying to a subfolder of the current folder (infinite loop).
         return 4;
     }
     $success = $this->succeed($dest);
     $filemask = substr($this->localpath, 0, -1) . '.*';
     if ($success) {
         //	replicate the album metadata and sub-files
         $uniqueset = array('folder' => $newfolder);
         $parentname = dirname($newfolder);
         if (empty($parentname) || $parentname == '/' || $parentname == '.') {
             $uniqueset['parentid'] = NULL;
         } else {
             $parent = newAlbum($parentname);
             $uniqueset['parentid'] = $parent->getID();
         }
         $newID = parent::copy($uniqueset);
         if ($newID) {
             //	replicate the tags
             storeTags(readTags($this->getID(), 'albums'), $newID, 'albums');
             //	copy the sidecar files
             $filestocopy = safe_glob($filemask);
             foreach ($filestocopy as $file) {
                 if (in_array(strtolower(getSuffix($file)), $this->sidecars)) {
                     $success = $success && @copy($file, dirname($dest) . '/' . basename($file));
                 }
             }
         }
     }
     if ($success) {
         return 0;
     } else {
         return 1;
     }
 }
コード例 #3
0
 /** For every album in the gallery, look for its file. Delete from the database
  * if the file does not exist. Do the same for images. Clean up comments that have
  * been left orphaned.
  *
  * Returns true if the operation was interrupted because it was taking too long
  *
  * @param bool $cascade garbage collect every image and album in the gallery.
  * @param bool $complete garbage collect every image and album in the *database* - completely cleans the database.
  * @param  int $restart Image ID to restart scan from
  * @return bool
  */
 function garbageCollect($cascade = true, $complete = false, $restart = '')
 {
     if (empty($restart)) {
         // Check for the existence of top-level albums (subalbums handled recursively).
         $result = query("SELECT * FROM " . prefix('albums'));
         $dead = array();
         $live = array('');
         // purge the root album if it exists
         $deadalbumthemes = array();
         // Load the albums from disk
         $albumfolder = getAlbumFolder();
         while ($row = mysql_fetch_assoc($result)) {
             if (!file_exists($albumfolder . UTF8ToFilesystem($row['folder'])) || in_array($row['folder'], $live)) {
                 $dead[] = $row['id'];
                 if ($row['album_theme'] !== '') {
                     // orphaned album theme options table
                     $deadalbumthemes[$row['id']] = $row['folder'];
                 }
             } else {
                 $live[] = $row['folder'];
             }
         }
         if (count($dead) > 0) {
             /* delete the dead albums from the DB */
             $first = array_pop($dead);
             $sql1 = "DELETE FROM " . prefix('albums') . " WHERE `id`='{$first}'";
             $sql2 = "DELETE FROM " . prefix('images') . " WHERE `albumid`='{$first}'";
             $sql3 = "DELETE FROM " . prefix('comments') . " WHERE `type`='albums' AND `ownerid`='{$first}'";
             $sql4 = "DELETE FROM " . prefix('obj_to_tag') . " WHERE `type`='albums' AND `objectid`='{$first}'";
             foreach ($dead as $albumid) {
                 $sql1 .= " OR `id` = '{$albumid}'";
                 $sql2 .= " OR `albumid` = '{$albumid}'";
                 $sql3 .= " OR `ownerid` = '{$albumid}'";
                 $sql4 .= " OR `objectid` = '{$albumid}'";
             }
             $n = query($sql1);
             if (!$complete && $n > 0 && $cascade) {
                 query($sql2);
                 query($sql3);
                 query($sql4);
             }
         }
         if (count($deadalbumthemes) > 0) {
             // delete the album theme options tables for dead albums
             foreach ($deadalbumthemes as $id => $deadtable) {
                 $sql = 'DELETE FROM ' . prefix('options') . ' WHERE `ownerid`=' . $id;
                 query($sql, true);
             }
         }
     }
     if ($complete) {
         if (empty($restart)) {
             /* refresh 'metadata' of dynamic albums */
             $albumfolder = getAlbumFolder();
             $albumids = query_full_array("SELECT `id`, `mtime`, `folder` FROM " . prefix('albums') . " WHERE `dynamic`='1'");
             foreach ($albumids as $album) {
                 if (($mtime = filemtime($albumfolder . UTF8ToFilesystem($album['folder']))) > $album['mtime']) {
                     // refresh
                     $data = file_get_contents($albumfolder . UTF8ToFilesystem($album['folder']));
                     while (!empty($data)) {
                         $data1 = trim(substr($data, 0, $i = strpos($data, "\n")));
                         if ($i === false) {
                             $data1 = $data;
                             $data = '';
                         } else {
                             $data = substr($data, $i + 1);
                         }
                         if (strpos($data1, 'WORDS=') !== false) {
                             $words = "words=" . urlencode(substr($data1, 6));
                         }
                         if (strpos($data1, 'THUMB=') !== false) {
                             $thumb = trim(substr($data1, 6));
                         }
                         if (strpos($data1, 'FIELDS=') !== false) {
                             $fields = "&searchfields=" . trim(substr($data1, 7));
                         }
                     }
                     if (!empty($words)) {
                         if (empty($fields)) {
                             $fields = '&searchfields=4';
                         }
                     }
                     $sql = "UPDATE " . prefix('albums') . "SET `search_params`=\"{$words}.{$fields}\", `thumb`=\"{$thumb}\", `mtime`=\"{$mtime}\" WHERE `id`=\"" . $album['id'] . "\"";
                     query($sql);
                 }
             }
             /* Delete all image entries that don't belong to an album at all. */
             $albumids = query_full_array("SELECT `id` FROM " . prefix('albums'));
             /* all the album IDs */
             $idsofalbums = array();
             foreach ($albumids as $row) {
                 $idsofalbums[] = $row['id'];
             }
             $imageAlbums = query_full_array("SELECT DISTINCT `albumid` FROM " . prefix('images'));
             /* albumids of all the images */
             $albumidsofimages = array();
             foreach ($imageAlbums as $row) {
                 $albumidsofimages[] = $row['albumid'];
             }
             $orphans = array_diff($albumidsofimages, $idsofalbums);
             /* albumids of images with no album */
             if (count($orphans) > 0) {
                 /* delete dead images from the DB */
                 $firstrow = array_pop($orphans);
                 $sql = "DELETE FROM " . prefix('images') . " WHERE `albumid`='" . $firstrow . "'";
                 foreach ($orphans as $id) {
                     $sql .= " OR `albumid`='" . $id . "'";
                 }
                 query($sql);
                 // Then go into existing albums recursively to clean them... very invasive.
                 foreach ($this->getAlbums(0) as $folder) {
                     $album = new Album($this, $folder);
                     if (!$album->isDynamic()) {
                         if (is_null($album->getDateTime())) {
                             // see if we can get one from an image
                             $image = $album->getImage(0);
                             if (is_object($image)) {
                                 $album->setDateTime($image->getDateTime());
                             }
                         }
                         $album->garbageCollect(true);
                         $album->preLoad();
                     }
                 }
             }
         }
         /* Look for image records where the file no longer exists. While at it, check for images with IPTC data to update the DB */
         $start = array_sum(explode(" ", microtime()));
         // protect against too much processing.
         if (!empty($restart)) {
             $restartwhere = ' WHERE `id`>' . $restart;
         } else {
             $restartwhere = '';
         }
         $sql = 'SELECT `id`, `albumid`, `filename`, `desc`, `title`, `date`, `mtime` FROM ' . prefix('images') . $restartwhere . ' ORDER BY `id`';
         $images = query_full_array($sql);
         foreach ($images as $image) {
             $sql = 'SELECT `folder` FROM ' . prefix('albums') . ' WHERE `id`="' . $image['albumid'] . '";';
             $row = query_single_row($sql);
             $imageName = UTF8ToFilesystem(getAlbumFolder() . $row['folder'] . '/' . $image['filename']);
             if (file_exists($imageName)) {
                 if ($image['mtime'] != filemtime($imageName)) {
                     // file has changed since we last saw it
                     /* check metadata */
                     $metadata = getImageMetadata($imageName);
                     $set = '';
                     /* title */
                     $defaultTitle = substr($image['filename'], 0, strrpos($image['filename'], '.'));
                     if (empty($defaultTitle)) {
                         $defaultTitle = $image['filename'];
                     }
                     if ($defaultTitle == $image['title']) {
                         /* default title */
                         if (isset($metadata['title'])) {
                             $set = ',`title`="' . mysql_real_escape_string($metadata['title']) . '"';
                         }
                     }
                     /* description */
                     if (!isset($row['desc'])) {
                         if (isset($metadata['desc'])) {
                             $set .= ', `desc`="' . mysql_real_escape_string($metadata['desc']) . '"';
                         }
                     }
                     /* tags */
                     if (isset($metadata['tags'])) {
                         $tags = $metadata['tags'];
                         storeTags($tags, $image['id'], 'images');
                     }
                     /* location, city, state, and country */
                     if (isset($metadata['location'])) {
                         $set .= ', `location`="' . mysql_real_escape_string($metadata['location']) . '"';
                     }
                     if (isset($metadata['city'])) {
                         $set .= ', `city`="' . mysql_real_escape_string($metadata['city']) . '"';
                     }
                     if (isset($metadata['state'])) {
                         $set .= ', `state`="' . mysql_real_escape_string($metadata['state']) . '"';
                     }
                     if (isset($metadata['country'])) {
                         $set .= ', `country`="' . mysql_real_escape_string($metadata['country']) . '"';
                     }
                     /* credit & copyright */
                     if (isset($metadata['credit'])) {
                         $set .= ', `credit`="' . escape($metadata['credit']) . '"';
                     }
                     if (isset($metadata['copyright'])) {
                         $set .= ', `copyright`="' . escape($metadata['copyright']) . '"';
                     }
                     /* date (for sorting) */
                     $newDate = strftime('%Y-%m-%d %T', filemtime($imageName));
                     if (isset($metadata['date'])) {
                         $dt = dateTimeConvert($metadata['date']);
                         if ($dt !== false) {
                             // flaw in exif/iptc data?
                             $newDate = $dt;
                         }
                     }
                     $set .= ', `date`="' . $newDate . '"';
                     /* update DB is necessary */
                     $sql = "UPDATE " . prefix('images') . " SET `EXIFValid`=0,`mtime`=" . filemtime($imageName) . $set . " WHERE `id`='" . $image['id'] . "'";
                     query($sql);
                 }
             } else {
                 $sql = 'DELETE FROM ' . prefix('images') . ' WHERE `id`="' . $image['id'] . '";';
                 $result = query($sql);
                 $sql = 'DELETE FROM ' . prefix('comments') . ' WHERE `type` IN (' . zp_image_types('"') . ') AND `ownerid` ="' . $image['id'] . '";';
                 $result = query($sql);
             }
             if (array_sum(explode(" ", microtime())) - $start >= 10) {
                 return $image['id'];
                 // avoide excessive processing
             }
         }
         /* clean the comments table */
         /* do the images */
         $imageids = query_full_array('SELECT `id` FROM ' . prefix('images'));
         /* all the image IDs */
         $idsofimages = array();
         foreach ($imageids as $row) {
             $idsofimages[] = $row['id'];
         }
         $commentImages = query_full_array("SELECT DISTINCT `ownerid` FROM " . prefix('comments') . 'WHERE `type` IN (' . zp_image_types('"') . ')');
         /* imageids of all the comments */
         $imageidsofcomments = array();
         foreach ($commentImages as $row) {
             $imageidsofcomments[] = $row['ownerid'];
         }
         $orphans = array_diff($imageidsofcomments, $idsofimages);
         /* image ids of comments with no image */
         if (count($orphans) > 0) {
             /* delete dead comments from the DB */
             $firstrow = array_pop($orphans);
             $sql = "DELETE FROM " . prefix('comments') . " WHERE `type` IN (" . zp_image_types("'") . ") AND `ownerid`='" . $firstrow . "'";
             foreach ($orphans as $id) {
                 $sql .= " OR `ownerid`='" . $id . "'";
             }
             query($sql);
         }
         /* do the same for album comments */
         $albumids = query_full_array('SELECT `id` FROM ' . prefix('albums'));
         /* all the album IDs */
         $idsofalbums = array();
         foreach ($albumids as $row) {
             $idsofalbums[] = $row['id'];
         }
         $commentAlbums = query_full_array("SELECT DISTINCT `ownerid` FROM " . prefix('comments') . 'WHERE `type`="albums"');
         /* album ids of all the comments */
         $albumidsofcomments = array();
         foreach ($commentAlbums as $row) {
             $albumidsofcomments[] = $row['ownerid'];
         }
         $orphans = array_diff($albumidsofcomments, $idsofalbums);
         /* album ids of comments with no album */
         if (count($orphans) > 0) {
             /* delete dead comments from the DB */
             $firstrow = array_pop($orphans);
             $sql = "DELETE FROM " . prefix('comments') . "WHERE `type`='albums' AND `ownerid`='" . $firstrow . "'";
             foreach ($orphans as $id) {
                 $sql .= " OR `ownerid`='" . $id . "'";
             }
             query($sql);
         }
         /* clean the tags table */
         /* do the images */
         $tagImages = query_full_array("SELECT DISTINCT `objectid` FROM " . prefix('obj_to_tag') . 'WHERE `type` IN (' . zp_image_types('"') . ')');
         /* imageids of all the comments */
         $imageidsoftags = array();
         foreach ($tagImages as $row) {
             $imageidsoftags[] = $row['objectid'];
         }
         $orphans = array_diff($imageidsoftags, $idsofimages);
         /* image ids of comments with no image */
         if (count($orphans) > 0) {
             /* delete dead tags from the DB */
             $firstrow = array_pop($orphans);
             $sql = "DELETE FROM " . prefix('obj_to_tag') . " WHERE `type` IN (" . zp_image_types('"') . ") AND (`objectid`='" . $firstrow . "'";
             foreach ($orphans as $id) {
                 $sql .= " OR `objectid`='" . $id . "'";
             }
             $sql .= ')';
             query($sql);
         }
         /* do the same for album tags */
         $tagAlbums = query_full_array("SELECT DISTINCT `objectid` FROM " . prefix('obj_to_tag') . 'WHERE `type`="albums"');
         /* album ids of all the comments */
         $albumidsoftags = array();
         foreach ($tagAlbums as $row) {
             $albumidsoftags[] = $row['objectid'];
         }
         $orphans = array_diff($albumidsoftags, $idsofalbums);
         /* album ids of comments with no album */
         if (count($orphans) > 0) {
             /* delete dead tags from the DB */
             $firstrow = array_pop($orphans);
             $sql = "DELETE FROM " . prefix('obj_to_tag') . "WHERE `type`='albums' AND `objectid`='" . $firstrow . "'";
             foreach ($orphans as $id) {
                 $sql .= " OR `objectid`='" . $id . "'";
             }
             query($sql);
         }
     }
     return false;
 }
コード例 #4
0
ファイル: classes.php プロジェクト: rb26/zenphoto
 /**
  * Stores tag information
  *
  * @param string $tags the tag list
  */
 function setTags($tags)
 {
     if (!$this->getID()) {
         //	requires a valid id to link tags to the object
         $this->save();
     }
     storeTags(array_unique($tags), $this->getID(), $this->table);
 }
コード例 #5
0
ファイル: modifyfav.php プロジェクト: noikiy/owaspbwa
     // cut tags if too long > 150 chars
     $tags = substr($tags, 0, 150);
     if ($tags != null) {
         //Check if the book was public
         $public = checkIfPublic($id);
         //Was public and still is (P P)
         if ($public && $newPublic) {
             //Make the changes to the tags, if any
             updateTags($id, $tags);
         }
         //Was not public, and now is (~ P)
         if (!$public && $newPublic) {
             //Add the tags
             addTags($tags);
             //Store the tags with the bookmark
             storeTags($id, $tags);
         }
         //Was public, and now is not (P ~)
         if ($public && !$newPublic) {
             //Remove (unstore) all the tags attached to this bookmark in table tags_books
             unstoreTags($id);
         }
     }
 }
 // update the favourites table
 $Query = sprintf("UPDATE " . TABLE_PREFIX . "favourites SET title=%s, url=%s, description=%s, LAST_MODIFIED = NOW() WHERE ID =" . $id, quote_smart($title), quote_smart($url), quote_smart($description));
 $AffectedRows = $dblink->exec($Query);
 if ($AffectedRows == 1) {
     echo "<p class=\"success\">" . T_("The bookmark has been updated") . ".</p>";
     $success = true;
 } else {
コード例 #6
0
    if ($link->query($sql) != true) {
        header('Location: fail.php');
    }
    //DELETE friends of cookboko
    $sql = "DELETE FROM Friends WHERE type='COOKBOOK' AND type_id ='{$cookbook_id}'";
    if ($link->query($sql) != true) {
        header('Location: fail.php');
    }
    //Update cookbook name and privacy
    $sql = "UPDATE Cookbook SET cb_title = '{$cookbookname}', visibility = '{$privacy}' WHERE cookbook_id = '{$cookbook_id}'";
    if ($link->query($sql) != true) {
        $error = "ERROR: Could not able to execute {$sql}. " . $link->connect_error;
    }
    //store array of tags in database
    if (isset($tags)) {
        storeTags($tags, $cb_id, $link);
    }
    //If its friendly, add emails
    if ($privacy == "friendly") {
        $count = storeFriends($email, $cb_id, $link);
        $error = $email;
    }
    redirect();
    mysqli_close($link);
    //close connection
}
function storeTags($tag, $cookbook_id, $link)
{
    $size = count($tag);
    for ($i = 0; $i < $size; $i++) {
        $current = $tag[$i];
コード例 #7
0
ファイル: classes.php プロジェクト: hatone/zenphoto-1.4.1.4
 /**
  * Stores tag information
  *
  * @param string $tags the tag list
  */
 function setTags($tags)
 {
     if (!is_array($tags)) {
         $tags = explode(',', $tags);
     }
     storeTags($tags, $this->id, $this->table);
 }
コード例 #8
0
    if ($link->query($sql) != true) {
        header('Location: fail.php');
    }
    //If its friendly, add emails
    if ($privacy == "friendly") {
        storeFriends($allemails, $cookbook_id, $link);
        //$check = $allemails;
    }
    //Update cookbook name and privacy
    $sql = "UPDATE Cookbook SET cb_title = '{$cookbookname}', visibility = '{$privacy}' WHERE cookbook_id = '{$cookbook_id}'";
    if ($link->query($sql) != true) {
        $error = "ERROR: Could not able to execute {$sql}. " . $link->connect_error;
    }
    //store array of tags in database
    if (isset($tags)) {
        storeTags($tags, $cookbook_id, $link);
    }
    redirect($cookbook_id);
    //redirect back to view cookbook
    mysqli_close($link);
    //close connection
}
//get title of cookbook
function getCookbookTitle($cookbook_id, $link)
{
    $sql = "SELECT cb_title FROM Cookbook WHERE cookbook_id = '{$cookbook_id}'";
    $result = $link->query($sql);
    $row = $result->fetch_assoc();
    return $row['cb_title'];
}
//get privacy setting
コード例 #9
0
 /**
  * Sets the tags of the image
  *
  * @param string $tags the tag string
  */
 function setTags($tags)
 {
     if (!is_array($tags)) {
         $tags = explode(',', $tags);
     }
     storeTags(filterTags($tags), $this->id, 'images');
 }
コード例 #10
0
 /**
  * Copies the image to a new album, along with all metadata.
  *
  * @param string $newalbum the destination album
  */
 function copy($newalbum)
 {
     if (is_string($newalbum)) {
         $newalbum = new Album($this->album->gallery, $newalbum, false);
     }
     if ($newalbum->id == $this->album->id) {
         // Nothing to do - moving the file to the same place.
         return 2;
     }
     $newpath = $newalbum->localpath . internalToFilesystem($this->filename);
     if (file_exists($newpath)) {
         // If the file exists, don't overwrite it.
         return 2;
     }
     $filename = basename($this->localpath);
     $result = @copy($this->localpath, $newpath);
     if ($result) {
         $filestocopy = safe_glob(substr($this->localpath, 0, strrpos($this->localpath, '.')) . '.*');
         foreach ($filestocopy as $file) {
             if (in_array(strtolower(getSuffix($file)), $this->sidecars)) {
                 $result = $result && @copy($file, $newalbum->localpath . basename($file));
             }
         }
     }
     if ($result) {
         if ($newID = parent::copy(array('filename' => $filename, 'albumid' => $newalbum->id))) {
             storeTags(readTags($this->getID(), 'images'), $newID, 'images');
             query('UPDATE ' . prefix('images') . ' SET `mtime`=' . filemtime($newpath) . ' WHERE `filename`="' . $filename . '" AND `albumid`=' . $newalbum->id);
             return 0;
         }
     }
     return 1;
 }
コード例 #11
0
ファイル: setup.php プロジェクト: ItsHaden/epicLanBootstrap
     $result = query_full_array($sql);
     if (is_array($result)) {
         foreach ($result as $row) {
             if (!empty($row['tags'])) {
                 $tags = explode(",", $row['tags']);
                 storeTags($tags, $row['id'], 'albums');
             }
         }
     }
     $sql = "SELECT `id`, `tags` FROM " . prefix('images');
     $result = query_full_array($sql);
     if (is_array($result)) {
         foreach ($result as $row) {
             if (!empty($row['tags'])) {
                 $tags = explode(",", $row['tags']);
                 storeTags($tags, $row['id'], 'images');
             }
         }
     }
     query("ALTER TABLE " . prefix('albums') . " DROP COLUMN `tags`");
     query("ALTER TABLE " . prefix('images') . " DROP COLUMN `tags`");
 }
 echo "<h3>";
 if ($taskDisplay[substr($task, 0, 8)] == 'create') {
     if ($createTables) {
         echo gettext('Done with table create!');
     } else {
         echo gettext('Done with table create with errors!');
     }
 } else {
     if ($createTables) {
コード例 #12
0
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, 
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once '/proj/www/dolphin.mahamudra.de/home/htdocs/inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'db.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'tags.inc.php';
$sLastParseTime = getParam('tags_last_parse_time');
//get last parsing time
db_res("UPDATE `GlParams` SET `VALUE` = NOW() WHERE `NAME` = 'tags_last_parse_time'");
//save last parsing time
if ((int) $sLastParseTime == 0) {
    $sLastParseTimeTS = 0;
} else {
    $sLastParseTimeTS = strtotime($sLastParseTime);
}
$rMembers = db_res("SELECT `ID`,            `Tags` AS `Tags` FROM `Profiles`        WHERE `LastModified` >= '{$sLastParseTime}' OR `LastReg` >= '{$sLastParseTime}' AND `Status` = 'Active'");
//$rPhotos  = db_res( "SELECT `medID` AS `ID`, `medTags`  AS `Tags` FROM `sharePhotoFiles` WHERE `medDate`      >= '$sLastParseTime'  AND `Approved` = 'true'" );
//$rVideos  = db_res( "SELECT `ID`,            `Tags`               FROM `RayMovieFiles`   WHERE `Date`         >=  $sLastParseTimeTS AND `Approved` = 'true'" );
//$rMusics  = db_res( "SELECT `ID`,            `Tags`               FROM `RayMusicFiles`   WHERE `Date`         >=  $sLastParseTimeTS AND `Approved` = 'true'" );
//$rBlogs   = db_res( "SELECT `PostID` AS `ID`,`Tags`               FROM `BlogPosts`       WHERE `PostDate`     >= '$sLastParseTime'  AND `PostStatus` = 'approval'" );
//$rAds     = db_res( "SELECT `ID`,            `Tags`               FROM `ClassifiedsAdvertisements` WHERE `DateTime` >= '$sLastParseTime' AND `status` = 'active'" );
//$rEvents  = db_res( "SELECT `ID`,            `Tags`               FROM `SDatingEvents`   WHERE `Status` = 'Active'" );
$aObjs = array('profile' => 'rMembers');
foreach ($aObjs as $sType => $sResource) {
    //echo $sResource . ' ' . $$sResource .'<hr>';
    while ($aObj = mysql_fetch_assoc(${$sResource})) {
        storeTags($aObj['ID'], $aObj['Tags'], $sType);
    }
}
コード例 #13
0
ファイル: tags_functions.php プロジェクト: noikiy/owaspbwa
function renameTag($username, $old, $new)
{
    //TODO: Complete the function for the API tags_rename
    if (is_null($userid) || is_null($old) || is_null($new)) {
        return false;
    }
    // Find bookmarks with old tag
    $bookmarksInfo =& $bookmarkservice->getBookmarks(0, NULL, $userid, $old);
    $bookmarks =& $bookmarksInfo['bookmarks'];
    // Delete old tag
    $this->deleteTag($old);
    // Attach new tags
    foreach (array_keys($bookmarks) as $key) {
        $row =& $bookmarks[$key];
        //Add the tags
        addTags($tags);
        //Store the tags with the bookmark
        storeTags($rec_id, $tags);
        $this->attachTags($row['bId'], $new, $fromApi, NULL, false);
    }
    return true;
}