Esempio n. 1
0
/**
 * Callback function dynamic creation of filters for the buildBackendFilter function
 *
 * @param array $list Reference to the list of WHERE conditions from the buildBackendFilter function
 * @param string $type Type of filter for SQL query
 * @param string $operator Operator for SQL query
 * @param int $value1 (optional) General purpose parameter for SQL query
 * @param int $value2 (optional) General purpose parameter for SQL query
 */
function FilesSearchCB(&$list, $type, $operator, $value1 = 0, $value2 = 0)
{
    $op = GetContainsOperators($operator);
    switch ($type) {
        case 'CREATEDTS':
            if (0 < $value1) {
                $list['WHERE'][] = 'prop.CREATEDTS ' . $op . ' ' . (int) $value1;
            }
            break;
        case 'CHANGEDTS':
            if (0 < $value1) {
                $list['WHERE'][] = 'prop.CHANGEDTS ' . $op . ' ' . (int) $value1;
            }
            break;
        case 'LIMITER':
            if ((int) $value2 > 0) {
                $list['LIMIT'][] = 'LIMIT ' . (int) $value1 . ',' . (int) $value2;
            }
            break;
        case 'ORDER':
            $colarr = explode(".", sYDB()->escape_string(sanitize($value1)));
            $value1 = "`" . implode("`.`", $colarr) . "`";
            if ($value2 != "DESC") {
                $value2 = "ASC";
            }
            $list['ORDER'][] = 'ORDER BY ' . $value1 . ' ' . $value2;
            break;
    }
}
Esempio n. 2
0
/**
 * Callback function dynamic creation of filters for the buildBackendFilter function
 *
 * @param array $list Reference to the list of WHERE conditions from the buildBackendFilter function
 * @param string $type Type of filter for SQL query
 * @param string $operator Operator for SQL query
 * @param int $value1 (optional) General purpose parameter for SQL query
 * @param int $value2 (optional) General purpose parameter for SQL query
 */
function TagGetByTagCB(&$list, $type, $operator, $value1 = 0, $value2 = 0)
{
    $op = GetContainsOperators($operator);
    switch ($type) {
        case "DELETED":
            if (0 < $value1) {
                $list["WHERE"][] = "object.DELETED " . $op . " " . (int) $value1;
            }
            break;
        case "LIMITER":
            if ((int) $value2 > 0) {
                $list["LIMIT"][] = "LIMIT " . (int) $value1 . "," . (int) $value2;
            }
            break;
    }
}
Esempio n. 3
0
/**
 * Callback function dynamic creation of filters for the buildBackendFilter function
 *
 * @param array $list Reference to the list of WHERE conditions from the buildBackendFilter function
 * @param string $type Type of filter for SQL query
 * @param string $operator Operator for SQL query
 * @param int $value1 (optional) General purpose parameter for SQL query
 * @param int $value2 (optional) General purpose parameter for SQL query
 */
function CBlocksSearchCB(&$list, $type, $operator, $value1 = 0, $value2 = 0)
{
    $op = GetContainsOperators($operator);
    switch ($type) {
        case "CREATEDTS":
            if (0 < $value1) {
                $list["WHERE"][] = "prop.CREATEDTS " . $op . " " . (int) $value1;
            }
            break;
        case "CHANGEDTS":
            if (0 < $value1) {
                $list["WHERE"][] = "prop.CHANGEDTS " . $op . " " . (int) $value1;
            }
            break;
        case "LIMITER":
            if ((int) $value2 > 0) {
                $list["LIMIT"][] = "LIMIT " . (int) $value1 . "," . (int) $value2;
            }
            break;
        case 'ORDER':
            $colarr = explode(".", sYDB()->escape_string(sanitize($value1)));
            $value1 = "`" . implode("`.`", $colarr) . "`";
            if ($value2 != "DESC") {
                $value2 = "ASC";
            }
            $list['ORDER'][] = 'ORDER BY ' . $value1 . ' ' . $value2;
            break;
    }
}
Esempio n. 4
0
/**
 * Callback function dynamic creation of filters for the buildBackendFilter function
 *
 * @param array $list Reference to the list of WHERE conditions from the buildBackendFilter function
 * @param string $type Type of filter for SQL query
 * @param string $operator Operator for SQL query
 * @param int $value1 (optional) General purpose parameter for SQL query
 * @param int $value2 (optional) General purpose parameter for SQL query
 */
function MailingsSearchCB(&$list, $type, $operator, $value1 = 0, $value2 = 0)
{
    $op = GetContainsOperators($operator);
    switch ($type) {
        case "STATUS":
            if ($value1 != 'ALL') {
                if (!in_array($value1, array('INPROGRESS', 'UNSENT', 'SENT', 'PAUSED', 'CANCELLED'))) {
                    break;
                }
                $list["WHERE"][] = "stat.STATUS = '" . sYDB()->escape_string($value1) . "'";
            }
            break;
        case "CREATEDTS":
            if ($value1 > 0) {
                $list["WHERE"][] = "prop.CREATEDTS " . $op . " " . (int) $value1;
            }
            break;
        case "CHANGEDTS":
            if ($value1 > 0) {
                $list["WHERE"][] = "prop.CHANGEDTS " . $op . " " . (int) $value1;
            }
            break;
        case "LIMITER":
            if ((int) $value2 > 0) {
                $list["LIMIT"][] = "LIMIT " . (int) $value1 . "," . (int) $value2;
            }
            break;
        case 'ORDER':
            $colarr = explode(".", sYDB()->escape_string(sanitize($value1)));
            $value1 = "`" . implode("`.`", $colarr) . "`";
            if ($value2 != "DESC") {
                $value2 = "ASC";
            }
            $list['ORDER'][] = 'ORDER BY ' . $value1 . ' ' . $value2;
            break;
    }
}
Esempio n. 5
0
/**
 * Callback function dynamic creation of filters for the buildBackendFilter function
 *
 * @param array $list Reference to the list of WHERE conditions from the buildBackendFilter function
 * @param string $type Type of filter for SQL query
 * @param string $operator Operator for SQL query
 * @param int $value1 (optional) General purpose parameter for SQL query
 * @param int $value2 (optional) General purpose parameter for SQL query
 */
function CommentsFilterCB(&$list, $type, $operator, $value1 = 0, $value2 = 0)
{
    $op = GetContainsOperators($operator);
    switch ($type) {
        case "CREATEDTS":
            if (0 < $value1) {
                $list["WHERE"][] = "c.CREATEDTS " . $op . " " . (int) $value1;
            }
            break;
        case "SPAM":
            $list["WHERE"][] = "c.SPAM " . $op . " " . (int) $value1;
            break;
        case "APPROVED":
            $list["WHERE"][] = "c.APPROVED " . $op . " " . (int) $value1;
            break;
        case "MODRIGHT":
            $list["HAVING"][] = "RMODERATE " . $op . " " . (int) $value1;
            break;
        case "COMMENTRIGHT":
            $list["HAVING"][] = "RCOMMENT " . $op . " " . (int) $value1;
            break;
        case "OBJECTTYPE":
            if (!in_array($value1, array("FILE", "CO", "PAGE", "MAILING"))) {
                break;
            }
            $list["HAVING"][] = "OBJECTTYPE " . $op . " '" . $value1 . "'";
            break;
        case "LIMITER":
            if ((int) $value2 > 0) {
                $list["LIMIT"][] = "LIMIT " . (int) $value1 . "," . (int) $value2;
            }
            break;
        case 'ORDER':
            $colarr = explode(".", sYDB()->escape_string(sanitize($value1)));
            $value1 = "`" . implode("`.`", $colarr) . "`";
            if ($value2 != "DESC") {
                $value2 = "ASC";
            }
            $list['ORDER'][] = 'ORDER BY ' . $value1 . ' ' . $value2;
            break;
    }
}