Example #1
0
 function art_synchronization($type = "")
 {
     switch ($type) {
         case "article":
         case "topic":
         case "category":
             $type = array($type);
             $clean = array($type);
             break;
         default:
             $type = null;
             $clean = array("category", "topic", "article", "text", "rate", "spotlight", "pingback", "trackback");
             break;
     }
     foreach ($clean as $item) {
         $handler =& xoops_getmodulehandler($item, $GLOBALS["artdirname"]);
         $handler->cleanOrphan();
         unset($handler);
     }
     /*
     if(empty($type) || in_array("category", $type)):
     $category_handler =& xoops_getmodulehandler("category", $GLOBALS["artdirname"]);
     $category_handler->setLastArticleIds();
     $category_handler->updateTrack();
     endif;
     */
     if (empty($type) || in_array("article", $type)) {
         $article_handler =& xoops_getmodulehandler("article", $GLOBALS["artdirname"]);
         $artConfig = art_load_config();
         $article_handler->cleanExpires($artConfig["article_expire"] * 24 * 3600);
     }
     return true;
 }
Example #2
0
 /**
  * Function to convert UNIX time to formatted time string
  */
 function art_formatTimestamp($time, $format = "c", $timeoffset = null)
 {
     $artConfig = art_load_config();
     if (strtolower($format) == "reg" || strtolower($format) == "") {
         $format = "c";
     }
     if ((strtolower($format) == "custom" || strtolower($format) == "c") && !empty($artConfig["formatTimestamp_custom"])) {
         $format = $artConfig["formatTimestamp_custom"];
     }
     xoops_load("xoopslocal");
     return XoopsLocal::formatTimestamp($time, $format, $timeoffset);
 }
Example #3
0
 function art_define_url_delimiter()
 {
     if (defined("URL_DELIMITER")) {
         if (!in_array(URL_DELIMITER, array("?", "/"))) {
             die("Exit on security");
         }
     } else {
         $moduleConfig = art_load_config();
         if (empty($moduleConfig["do_urw"])) {
             define("URL_DELIMITER", "?");
         } else {
             define("URL_DELIMITER", "/");
         }
     }
 }
Example #4
0
 /**
  * Function to respond to a trackback
  */
 function art_trackback_response($error = 0, $error_message = '')
 {
     $moduleConfig = art_load_config();
     if (!empty($moduleConfig["do_trackbackutf8"])) {
         $charset = "utf-8";
         $error_message = xoops_utf8_encode($error_message);
     } else {
         $charset = _CHARSET;
     }
     header('Content-Type: text/xml; charset="' . $charset . '"');
     if ($error) {
         echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
         echo "<response>\n";
         echo "<error>1</error>\n";
         echo "<message>{$error_message}</message>\n";
         echo "</response>";
         die;
     } else {
         echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
         echo "<response>\n";
         echo "<error>0</error>\n";
         echo "</response>";
     }
 }
Example #5
0
 * @since           1.0
 * @author          Taiwen Jiang <*****@*****.**>
 * @version         $Id: vars.php 2283 2008-10-12 03:36:13Z phppp $
 */
if (!defined("ARTICLE_INI")) {
    define("ARTICLE_INI", 1);
}
/*
 * The prefix for database table name prefix
 * You can change to any term but be consistent with the table names in /sql/mysql.sql, and be unique , no conflict with other modules
 */
$GLOBALS["ART_DB_PREFIX"] = "art";
/* You are not supposed to modify following contents */
defined("FRAMEWORKS_ART_FUNCTIONS_INI") || (require_once XOOPS_ROOT_PATH . "/Frameworks/art/functions.ini.php");
$GLOBALS["artdirname"] = basename(dirname(dirname(__FILE__)));
/*
 * The prefix for module variables
 * You can change to any term but be unique, no conflict with other modules
 */
$GLOBALS["ART_VAR_PREFIX"] = $GLOBALS["artdirname"];
/*
 * The prefix for module language constants
 * You can chnage to any term but be capital and unique, no conflict with other modules
 */
$GLOBALS["ART_VAR_PREFIXU"] = strtoupper($GLOBALS["artdirname"]);
require_once XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/include/functions.ini.php";
// include customized variables
if (is_object($GLOBALS["xoopsModule"]) && $GLOBALS["artdirname"] == $GLOBALS["xoopsModule"]->getVar("dirname", "n")) {
    $GLOBALS["xoopsModuleConfig"] = art_load_config();
}
//art_load_object();
Example #6
0
function b_marquee_article($limit, $dateformat, $itemsize)
{
    global $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php';
    require_once XOOPS_ROOT_PATH . "/modules/article/include/functions.php";
    $block = array();
    $myts =& MyTextSanitizer::getInstance();
    static $access_cats;
    $artConfig = art_load_config();
    art_define_url_delimiter();
    $select = "art_id";
    $disp_tag = "";
    $from = "";
    $where = "";
    $order = "art_time_publish DESC";
    $select .= ", cat_id, art_title, uid, art_time_publish";
    if (!isset($access_cats)) {
        $permission_handler =& xoops_getmodulehandler("permission", "article");
        $access_cats =& $permission_handler->getCategories("access");
    }
    $allowed_cats = $access_cats;
    $query = "SELECT {$select} FROM " . art_DB_prefix("article") . $from;
    $query .= " WHERE cat_id IN (" . implode(",", $allowed_cats) . ") AND art_time_publish >0 " . $where;
    $query .= " ORDER BY " . $order;
    $query .= " LIMIT 0, " . $limit;
    if (!($result = $xoopsDB->query($query))) {
        return false;
    }
    $rows = array();
    $author = array();
    while ($row = $xoopsDB->fetchArray($result)) {
        $rows[] = $row;
        $author[$row["uid"]] = 1;
    }
    if (count($rows) < 1) {
        return false;
    }
    $author_name = XoopsUser::getUnameFromId(array_keys($author));
    $arts = array();
    $uids = array();
    $cids = array();
    $article_handler =& xoops_getmodulehandler("article", "article");
    foreach ($rows as $row) {
        $article =& $article_handler->create(false);
        $article->assignVars($row);
        $_art = array();
        foreach ($row as $tag => $val) {
            $_art[$tag] = @$article->getVar($tag);
        }
        $_art["author"] = $author_name[$row["uid"]];
        $_art["date"] = $article->getTime($dateformat);
        $titlelength = $itemsize + 3;
        $_art["title"] = xoops_substr($_art["art_title"], 0, $titlelength);
        $_art["category"] = '';
        $delimiter = "/";
        $_art["link"] = "<a href=\"" . XOOPS_URL . "modules/article/view.article.php{$delimiter}" . $_art["art_id"] . "/c" . $_art["cat_id"] . "\"><strong>" . $_art["art_title"] . "</strong></a>";
        $arts[] = $_art;
        unset($article, $_art);
        $cids[$row["cat_id"]] = 1;
    }
    $block = $arts;
    return $block;
}
Example #7
0
 /**
  * Function to get url of an image located in module utility image folder
  *
  * @var string     $imageName image file name
  * @var string     $imagePath full path to the image file if different from preset folder
  *
  * @return string image url
  */
 function art_getImageUrl($imageName, $imagePath = null)
 {
     global $xoopsModuleConfig, $xoopsModule;
     if (empty($imageName)) {
         return null;
     }
     if (empty($imagePath)) {
         $moduleConfig = art_load_config();
         $path_image = $moduleConfig["path_image"];
         $imageUrl = XOOPS_URL . "/" . $path_image . "/" . htmlspecialchars($imageName);
     } else {
         $imageUrl = htmlspecialchars(XOOPS_URL . "/" . preg_replace("/^" . preg_quote(XOOPS_ROOT_PATH, "/") . "/", "", $imagePath) . "/" . $imageName);
     }
     return $imageUrl;
 }