function removeTag($userId, $tagName) { global $client, $key; $tagId = getTagId($tagName); $call = new xmlrpcmsg("ContactService.removeFromGroup", array(php_xmlrpc_encode($key), php_xmlrpc_encode($userId), php_xmlrpc_encode($tagId))); $result = $client->send($call); }
/** * Removes a tag from a certain vote. It first makes sure that it matches and * it's the right tag to remove, so we don't end up removing bogus tags. */ function removeVoteTag($room, $year, $idvote, $tag) { global $uid; if ($uid == 0) { return; } // get the tag id; $idtag = getTagId($tag, $uid); $s = mysql_query("\n SELECT id\n FROM parl_tagged_votes\n WHERE\n votes_table = '{$room}_{$year}_votes_details' AND\n idvote = {$idvote} AND\n uid = {$uid} AND\n idtag = {$idtag}\n "); if ($r = mysql_fetch_array($s)) { $si = mysql_query("\n DELETE FROM parl_tagged_votes\n WHERE\n votes_table = '{$room}_{$year}_votes_details' AND\n idvote = {$idvote} AND\n uid = {$uid} AND\n idtag = {$idtag}\n "); echo 'done'; } else { echo 'error'; } }
function produceTagIds($string) { $tagids = array(); //Tags aus String auslesen $tags = explode(',', $string); $tags = array_map('trim', $tags); //Tags produzieren foreach ($tags as $tag) { if (!$tag) { continue; } $id = getTagId($tag); if (!$id) { $id = createTag($tag); } $tagids[] = $id; } return $tagids; }
} if ($_REQUEST['conn'] == 'or') { $conn = ' OR '; } else { $conn = ' AND '; } $search = array(); foreach ($items as $regexp) { $tagmatch = array_shift($tagmatches); $search[] = " ( " . iif($tagmatch, " id IN (" . implode(',', $tagmatch) . ") OR ") . " title " . $regexp . " OR text " . $regexp . " ) "; } $where .= iif($where, ' AND ') . ' ( ' . implode($conn, $search) . ' ) '; } //Nach Tag suchen if ($_REQUEST['tag']) { $tagid = getTagId($_REQUEST['tag']); if ($tagid) { $data = $db->fetch("SELECT id FROM " . PRE . "_videos_tags WHERE tagid='" . $tagid . "'"); $ids = get_ids($data, 'id'); if ($ids) { $where .= iif($where, ' AND ') . ' id IN (' . implode(',', $ids) . ') '; } else { $where .= iif($where, ' AND ') . ' 0 '; } } else { $where .= iif($where, ' AND ') . ' 0 '; } } //Kategorie if ($_REQUEST['catid']) { $cattree = videos_tree($_REQUEST['catid']);
<?php /// Copyright (c) 2004-2012, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; $cache = pageCache::getInstance(); if (strlen($suri['value'])) { if (!isset($suri['id']) || Setting::getBlogSettingGlobal('useSloganOnTag', 1) == 1) { $tag = getTagId($blogid, $suri['value']); $listFeedURL = 'tag/' . $suri['value']; } else { $tag = $suri['id']; $suri['value'] = getTagById($blogid, $suri['id']); $listFeedURL = 'tag/' . $suri['id']; } $preservedEntries = $entryCache = $listCache = null; if ($skinSetting['showListOnTag'] != 0) { $cache->reset(); $cache->name = 'tagList-' . $tag . '-' . $suri['page'] . '-'; if (!$cache->load()) { $listWithPaging = getEntryListWithPagingByTag($blogid, $tag, $suri['page'], $blog['entriesOnList']); if (!array_key_exists('total', $listWithPaging[1])) { $listWithPaging[1]['total'] = 0; } $list = array('title' => $suri['value'], 'items' => $listWithPaging[0], 'count' => $listWithPaging[1]['total']); $paging = $listWithPaging[1]; } else { $paging = $cache->dbContents; $listCache = $cache; //preserve for ordering
function convertTagsToArray($string) { $tags = explode('/', $string); $tagsArray = []; foreach ($tags as $tag) { $tagId = getTagId($tag); if ($tagId != NULL) { $tagsArray[] = $tagId; } } return $tagsArray; }
function addTag($blogid, $name) { $tagId = getTagId($blogid, $name); if (empty($tagId)) { $query = DBModel::getInstance(); $query->reset("Tags"); $insertId = Tag::_getMaxId() + 1; $query->setAttribute('id', $insertId); $query->setAttribute('name', $name, true); if ($query->insert()) { return $insertId; } else { return false; } } else { return $tagId; } }
$sqlWhere .= ' AND compl=0'; } $tag = trim(_get('t')); if ($tag != '') { $at = explode(',', $tag); $tagIds = array(); $tagExIds = array(); foreach ($at as $i => $atv) { $atv = trim($atv); if ($atv == '' || $atv == '^') { continue; } if (substr($atv, 0, 1) == '^') { $tagExIds[] = getTagId(substr($atv, 1)); } else { $tagIds[] = getTagId($atv); } } if (sizeof($tagIds) > 1) { $inner .= "INNER JOIN (SELECT task_id, COUNT(tag_id) AS c FROM {mytinytodo_tag2task} WHERE list_id={$listId} AND tag_id IN (" . implode(',', $tagIds) . ") GROUP BY task_id) AS t2t ON id=t2t.task_id"; $sqlWhere = " AND c=" . sizeof($tagIds); //overwrite sqlWhere! } elseif ($tagIds) { $inner .= "INNER JOIN {mytinytodo_tag2task} ON id=task_id"; $sqlWhere .= " AND tag_id = " . $tagIds[0]; } if ($tagExIds) { $sqlWhere .= " AND id NOT IN (SELECT DISTINCT task_id FROM {mytinytodo_tag2task} WHERE list_id={$listId} AND tag_id IN (" . implode(',', $tagExIds) . "))"; //DISTINCT ? } }
function loadTasks($listId, $compl = 0, $tag = '', $s = '', $sort = 0, $setCompl = 0, $setNotification = null) { $db = DBConnection::instance(); $sqlWhere = $inner = ''; if ($listId == -1) { $userLists = getUserListsSimple(); $sqlWhere .= " AND {$db->prefix}todolist.list_id IN (" . implode(array_keys($userLists), ',') . ") "; } else { $sqlWhere .= " AND {$db->prefix}todolist.list_id=" . $listId; } if ($compl == 0) { $sqlWhere .= ' AND compl=0'; } $tag = trim($tag); if ($tag != '') { $at = explode(',', $tag); $tagIds = array(); $tagExIds = array(); foreach ($at as $i => $atv) { $atv = trim($atv); if ($atv == '' || $atv == '^') { continue; } if (substr($atv, 0, 1) == '^') { $tagExIds[] = getTagId(substr($atv, 1)); } else { $tagIds[] = getTagId($atv); } } if (sizeof($tagIds) > 1) { $inner .= "INNER JOIN (SELECT task_id, COUNT(tag_id) AS c FROM {$db->prefix}tag2task WHERE list_id={$listId} AND tag_id IN (" . implode(',', $tagIds) . ") GROUP BY task_id) AS t2t ON id=t2t.task_id"; $sqlWhere = " AND c=" . sizeof($tagIds); //overwrite sqlWhere! } elseif ($tagIds) { $inner .= "INNER JOIN {$db->prefix}tag2task ON {$db->prefix}todolist.id={$db->prefix}tag2task.task_id"; $sqlWhere .= " AND {$db->prefix}tag2task.tag_id = " . $tagIds[0]; } if ($tagExIds) { $sqlWhere .= " AND id NOT IN (SELECT DISTINCT task_id FROM {$db->prefix}tag2task WHERE list_id={$listId} AND tag_id IN (" . implode(',', $tagExIds) . "))"; //DISTINCT ? } } $s = trim($s); if ($s != '') { $sqlWhere .= " AND (title LIKE " . $db->quoteForLike("%%%s%%", $s) . " OR note LIKE " . $db->quoteForLike("%%%s%%", $s) . ")"; } $sort = $sort; $sqlSort = "ORDER BY compl ASC, "; if ($sort == 1) { $sqlSort .= "prio DESC, ddn ASC, duedate ASC, ow ASC"; } elseif ($sort == 101) { $sqlSort .= "prio ASC, ddn DESC, duedate DESC, ow DESC"; } elseif ($sort == 2) { $sqlSort .= "ddn ASC, duedate ASC, prio DESC, ow ASC"; } elseif ($sort == 102) { $sqlSort .= "ddn DESC, duedate DESC, prio ASC, ow DESC"; } elseif ($sort == 3) { $sqlSort .= "d_created ASC, prio DESC, ow ASC"; } elseif ($sort == 103) { $sqlSort .= "d_created DESC, prio ASC, ow DESC"; } elseif ($sort == 4) { $sqlSort .= "d_edited ASC, prio DESC, ow ASC"; } elseif ($sort == 104) { $sqlSort .= "d_edited DESC, prio ASC, ow DESC"; } else { $sqlSort .= "ow ASC"; } $t = array(); $t['total'] = 0; $t['list'] = array(); $q = $db->dq("SELECT *, duedate IS NULL AS ddn FROM {$db->prefix}todolist {$inner} WHERE 1=1 {$sqlWhere} {$sqlSort}"); while ($r = $q->fetch_assoc($q)) { $t['total']++; $t['list'][] = prepareTaskRow($r); } if ($setCompl && have_write_access($listId)) { $bitwise = $compl == 0 ? 'taskview & ~1' : 'taskview | 1'; $db->dq("UPDATE {$db->prefix}lists SET taskview={$bitwise} WHERE id={$listId}"); } if (($setNotification === '0' || $setNotification === '1') && have_write_access($listId)) { if ($setNotification == 1) { NotificationListener::enableNotification(NotificationListener::LISTENER_TYPE_LIST, $listId); } else { NotificationListener::disableNotification(NotificationListener::LISTENER_TYPE_LIST, $listId); } } return $t; }
function addTagsToExperiment($eid, $tag_list) { global $db; $zipped_list = array(); foreach ($tag_list as $t) { if (!array_key_exists($t['value'], $zipped_list)) { $zipped_list[$t['value']] = $t['weight']; } else { // If the tag is already present with a lower weight, then replace with higher weight if ($zipped_list[$t['value']] < $t['weight']) { $zipped_list[$t['value']] = $t['weight']; } } } $tag_cache = array(); foreach ($zipped_list as $k => $v) { $id = -1; if (!array_key_exists($k, $tag_cache)) { $id = getTagId($k); if ($id == -1) { $id = addTag($k, $v > 0 ? 1 : 0); } $tag_cache[$k] = $id; } else { $id = $tag_cache[$k]; } addTagToExperiment($eid, $id, $v); } updateTimeModifiedForExperiment($eid); return true; }
foreach ($experiments as $exp) { $eid = $exp['experiment_id']; $name = preg_split("[\\s+]", $exp['name']); $desc = preg_split("[\\s+]", $exp['description']); foreach ($name as $n) { if (strlen($n) > 1) { $tid = getTagId(safeString($n)); if ($tid == -1) { $tid = addTag(safeString($n), 1); } addTagToExperiment($eid, $tid, 1); } } foreach ($desc as $n) { if (strlen($n) > 1) { $tid = getTagId(safeString($n)); if ($tid == -1) { $tid = addTag(safeString($n), 1); } addTagToExperiment($eid, $tid, 1); } } } break; case "migrateimgs": $s3 = new S3(AWS_ACCESS_KEY, AWS_SECRET_KEY); $url = "http://s3.amazonaws.com/isenseimgs/"; $img_dir = PIC_DIR . 's3/'; $dir = opendir($img_dir); while (($file = readdir($dir)) !== false) { $id = substr($file, 0, strpos($file, ".") + 1);
function getPreviousTweets($tag) { global $conn; if (($tid = getTagId($tag)) != -1) { $sql = "SELECT neg_tweet,pos_tweet FROM tweet WHERE tag_id='" . $tid . "';"; $res = $conn->query($sql); $row = $res->fetch_assoc(); return array($row["neg_tweet"], $row["pos_tweet"]); } }