/** Function to delete an entity with given Id */
 function trash($module, $id)
 {
     global $log, $current_user, $adb;
     if (!self::isBulkSaveMode()) {
         require_once "include/events/include.inc";
         $em = new VTEventsManager($adb);
         // Initialize Event trigger cache
         $em->initTriggerCache();
         $entityData = VTEntityData::fromEntityId($adb, $id);
         $em->triggerEvent("vtiger.entity.beforedelete", $entityData);
     }
     $this->mark_deleted($id);
     $this->unlinkDependencies($module, $id);
     require_once 'libraries/freetag/freetag.class.php';
     $freetag = new freetag();
     $freetag->delete_all_object_tags_for_user($current_user->id, $id);
     $sql_recentviewed = 'DELETE FROM vtiger_tracker WHERE user_id = ? AND item_id = ?';
     $this->db->pquery($sql_recentviewed, array($current_user->id, $id));
     if ($em) {
         $em->triggerEvent("vtiger.entity.afterdelete", $entityData);
     }
 }
Example #2
0
/**
 * Function to get the Tags where condition
 * @param  string $search_val -- entered search string value
 * @param  string $current_user_id     -- current user id
 * @return string $where      -- where condition with the list of crmids, will like vtiger_crmentity.crmid in (1,3,4,etc.,)
 */
function getTagWhere($search_val, $current_user_id)
{
    require_once 'include/freetag/freetag.class.php';
    $freetag_obj = new freetag();
    $crmid_array = $freetag_obj->get_objects_with_tag_all($search_val, $current_user_id);
    $where = " vtiger_crmentity.crmid IN (";
    if (count($crmid_array) > 0) {
        foreach ($crmid_array as $index => $crmid) {
            $where .= $crmid . ',';
        }
        $where = trim($where, ',') . ')';
    } else {
        $where .= '0)';
    }
    return $where;
}
Example #3
0
include "helpers.php";
include "mp3info.php";
require_once "/var/www/freetag/freetag.class.php";
if (isset($_GET['refresh'])) {
    delete_all_showtunes(-1);
}
import_show(-1, $randomizer_path, 0);
?>
<table align='center' border="1px dotted #909090"><tr><td><h2>Song Name</h2></td><td><h2>Filename</h2></td><td><h2>Artist</h2></td><td><h2>Album</h2></td><td><h2>time</h2></td><td><h2>Operation</h2></td><td><h2>tags</h2></td></tr>
<?php 
$sql = "select * from tunes where showid='-1' and type='0'";
if (!($result = mysql_query($sql))) {
    print mysql_error();
} else {
    $freetag_options = array('db_user' => 'root', 'db_pass' => '', 'db_host' => 'localhost', 'db_name' => 'tunequeue');
    $freetag = new freetag($freetag_options);
    $userid = 1;
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        print "<tr align='center'><td>\n";
        print $line['title'] . "</td><td>\n";
        print $line['fullpath'] . "</td><td>\n";
        $artist_name = get_artist_name($line['artistid']);
        print $artist_name . "</td><td>\n";
        print $line['album'] . "</td><td>\n";
        print $line['time'] . "</td>\n";
        /*Only tag by the super musician/user*/
        print "<td><a href='edit-song.php?edit=1&showid=-1&id=" . $line['ID'] . "'>Edit</a> /\n";
        print "<a href='edit-song.php?remove=1&showid=-1&id=" . $line['ID'] . "'>Remove</a></td>\n";
        print "<td>\n";
        $tagArray = $freetag->get_tags_on_object($line['ID'], 0, 0, $userid);
        if (count($tagArray) > 0) {
Example #4
0
require_once 'Smarty_setup.php';
require_once 'include/freetag/freetag.class.php';
$homeObj = new Homestuff();
$smarty = new vtigerCRM_Smarty();
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
if (!empty($_REQUEST['homestuffid'])) {
    $stuffid = $_REQUEST['homestuffid'];
}
if (!empty($_REQUEST['blockstufftype'])) {
    $stufftype = $_REQUEST['blockstufftype'];
}
if ($stufftype == 'Tag Cloud') {
    $freetag = new freetag();
    $smarty->assign("ALL_TAG", $freetag->get_tag_cloud_html("", $current_user->id));
    $smarty->display("Home/TagCloud.tpl");
} elseif ($stufftype == 'Notebook') {
    $contents = $homeObj->getNoteBookContents($stuffid);
    $smarty->assign("NOTEBOOK_CONTENTS", $contents);
    $smarty->assign("NOTEBOOKID", $stuffid);
    $smarty->display("Home/notebook.tpl");
} elseif ($stufftype == 'URL') {
    $url = $homeObj->getWidgetURL($stuffid);
    if (strpos($url, "://") === false) {
        $url = "http://" . trim($url);
    }
    $smarty->assign("URL", $url);
    $smarty->assign("WIDGETID", $stuffid);
    $smarty->display("Home/HomeWidgetURL.tpl");
Example #5
0
 /** Function to delete an entity with given Id */
 function trash($module, $id)
 {
     global $log, $current_user;
     $this->mark_deleted($id);
     $this->unlinkDependencies($module, $id);
     require_once 'include/freetag/freetag.class.php';
     $freetag = new freetag();
     $freetag->delete_all_object_tags_for_user($current_user->id, $id);
     $sql_recentviewed = 'DELETE FROM vtiger_tracker WHERE user_id = ? AND item_id = ?';
     $this->db->pquery($sql_recentviewed, array($current_user->id, $id));
 }
Example #6
0
            echo $tagcloud;
        }
    } else {
        echo ":#:FAILURE";
    }
} elseif ($ajaxaction == 'GETTAGCLOUD') {
    require_once 'include/freetag/freetag.class.php';
    $freetag = new freetag();
    if (trim($module) != "") {
        $tagcloud = $freetag->get_tag_cloud_html($module, $userid, $crmid);
        echo $tagcloud;
    } else {
        $tagcloud = $freetag->get_tag_cloud_html("", $userid);
        echo $tagcloud;
    }
} elseif ($ajaxaction == 'DELETETAG') {
    if (is_numeric($_REQUEST['tagid'])) {
        $tagid = vtlib_purify($_REQUEST['tagid']);
        require_once 'include/freetag/freetag.class.php';
        $freetag = new freetag();
        $tag = $freetag->get_tag_from_id($tagid);
        $delok = $freetag->delete_object_tag($userid, $crmid, $tag);
        if ($delok) {
            echo 'SUCCESS';
        } else {
            die("An invalid tagid to delete.");
        }
    } else {
        die("An invalid tagid to delete.");
    }
}
Example #7
0
/**	Function to get the Tags where condition
 *	@param  string $search_val -- entered search string value
 *	@param  string $current_user_id     -- current user id
 *	@return string $where      -- where condition with the list of crmids, will like ec_crmentity.crmid in (1,3,4,etc.,)
 */
function getTagWhere($search_val, $current_user_id, $search_module = '')
{
    require_once 'include/freetag/freetag.class.php';
    $freetag_obj = new freetag();
    $crmid_array = $freetag_obj->get_objects_with_tag_all($search_val, $current_user_id);
    $entityArr = getEntityTable($search_module);
    $ec_crmentity = $entityArr["tablename"];
    $entityidfield = $entityArr["entityidfield"];
    $crmid = $ec_crmentity . "." . $entityidfield;
    $where = '';
    if (count($crmid_array) > 0) {
        $where = $crmid . " IN (";
        foreach ($crmid_array as $index => $crmid) {
            $where .= $crmid . ',';
        }
        $where = trim($where, ',') . ')';
    }
    return $where;
}
 /** Function to delete an entity with given Id */
 function trash($module, $id)
 {
     global $log, $current_user, $adb;
     $recordType = Vtiger_Functions::getCRMRecordType($id);
     if ($recordType != $module) {
         throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
     }
     if (!self::isBulkSaveMode()) {
         require_once "include/events/include.inc";
         $em = new VTEventsManager($adb);
         // Initialize Event trigger cache
         $em->initTriggerCache();
         $entityData = VTEntityData::fromEntityId($adb, $id);
         $em->triggerEvent("vtiger.entity.beforedelete", $entityData);
     }
     $this->mark_deleted($id);
     $this->unlinkDependencies($module, $id);
     require_once 'libraries/freetag/freetag.class.php';
     $freetag = new freetag();
     $freetag->delete_all_object_tags_for_user($current_user->id, $id);
     $this->db->delete('vtiger_tracker', 'user_id = ? AND item_id = ?', [$current_user->id, $id]);
     if ($em) {
         $em->triggerEvent("vtiger.entity.afterdelete", $entityData);
     }
 }
Example #9
0
    require_once 'include/freetag/freetag.class.php';
    $tagfields = function_exists(iconv) ? @iconv("UTF-8", $default_charset, $_REQUEST['tagfields']) : $_REQUEST['tagfields'];
    $tagfields = str_replace(array("'", '"'), '', $tagfields);
    if ($tagfields != "") {
        $freetag = new freetag();
        if (isset($_REQUEST["tagfields"]) && trim($_REQUEST["tagfields"]) != "") {
            $freetag->tag_object($userid, $crmid, $tagfields, $module);
            $tagcloud = $freetag->get_tag_cloud_html($module, $userid, $crmid);
            echo $tagcloud;
        }
    } else {
        echo ":#:FAILURE";
    }
} elseif ($ajaxaction == 'GETTAGCLOUD') {
    require_once 'include/freetag/freetag.class.php';
    $freetag = new freetag();
    if (trim($module) != "") {
        $tagcloud = $freetag->get_tag_cloud_html($module, $userid, $crmid);
        echo $tagcloud;
    } else {
        $tagcloud = $freetag->get_tag_cloud_html("", $userid);
        echo $tagcloud;
    }
} elseif ($ajaxaction == 'DELETETAG') {
    if (is_numeric($_REQUEST['tagid'])) {
        $tagid = $_REQUEST['tagid'];
        $adb = PearDatabase::getInstance();
        $query = "delete from vtiger_freetagged_objects where tag_id=? and object_id=?";
        $result = $adb->pquery($query, array($tagid, $crmid));
        echo 'SUCCESS';
    } else {
Example #10
0
 /**
  * this function returns the information about a widget in an array
  * @return array(stuffid=>"id", stufftype=>"type", stufftitle=>"title")
  */
 function getHomePageFrame()
 {
     global $adb;
     global $current_user;
     $querystuff = "select vtiger_homestuff.stuffid,stufftype,stufftitle,setype from vtiger_homestuff \n\t\t\t\t\t\tleft join vtiger_homedefault on vtiger_homedefault.stuffid=vtiger_homestuff.stuffid\n\t\t\t\t\t\twhere visible=0 and userid=? order by stuffsequence desc";
     $resultstuff = $adb->pquery($querystuff, array($current_user->id));
     for ($i = 0; $i < $adb->num_rows($resultstuff); $i++) {
         $modulename = $adb->query_result($resultstuff, $i, 'setype');
         $stuffid = $adb->query_result($resultstuff, $i, 'stuffid');
         $stufftype = $adb->query_result($resultstuff, $i, 'stufftype');
         if (!empty($modulename) && $modulename != 'NULL') {
             if (!vtlib_isModuleActive($modulename)) {
                 continue;
             }
         } elseif ($stufftype == 'Module') {
             //check for setype in vtiger_homemodule table and hide if module is de-activated
             $sql = "select setype from vtiger_homemodule where stuffid=?";
             $result_setype = $adb->pquery($sql, array($stuffid));
             if ($adb->num_rows($result_setype) > 0) {
                 $module_name = $adb->query_result($result_setype, 0, "setype");
             }
             if (!empty($module_name) && $module_name != 'NULL') {
                 if (!vtlib_isModuleActive($module_name)) {
                     continue;
                 }
             }
         } elseif ($stufftype == 'DashBoard') {
             if (!vtlib_isModuleActive('Dashboard')) {
                 continue;
             }
         } elseif (!empty($stufftype) && $stufftype == 'RSS') {
             if (!vtlib_isModuleActive($stufftype)) {
                 continue;
             }
         }
         $nontrans_stufftitle = $adb->query_result($resultstuff, $i, 'stufftitle');
         $trans_stufftitle = getTranslatedString($nontrans_stufftitle);
         $stufftitle = decode_html($trans_stufftitle);
         if (strlen($stufftitle) > 100) {
             $stuff_title = substr($stufftitle, 0, 97) . "...";
         } else {
             $stuff_title = $stufftitle;
         }
         if ($stufftype == 'Default' && $nontrans_stufftitle != 'Home Page Dashboard' && $nontrans_stufftitle != 'Tag Cloud') {
             if ($modulename != 'NULL') {
                 if (isPermitted($modulename, 'index') == "yes") {
                     $count_entries = $this->getDefaultDetails($stuffid, 'calculateCnt');
                     if ($count_entries > 0) {
                         $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
                     }
                 }
             } else {
                 $count_entries = $this->getDefaultDetails($stuffid, 'calculateCnt');
                 if ($count_entries > 0) {
                     $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
                 }
             }
         } else {
             if ($stufftype == 'Tag Cloud') {
                 $freetag = new freetag();
                 if ($freetag->get_tag_cloud_html("", $current_user->id) != '') {
                     $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
                 }
             } else {
                 if ($modulename != 'NULL') {
                     if (isPermitted($modulename, 'index') == "yes") {
                         $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
                     }
                 } else {
                     $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
                 }
             }
         }
     }
     $homeframe = $homeval;
     return $homeframe;
 }