define('COMPRESS_LEVEL', 4); } // Lets support older PHP versions so we can use spanking new functions require JAWS_PATH . 'include/Jaws/PHPFunctions.php'; // lets setup the include_path set_include_path('.' . PATH_SEPARATOR . JAWS_PATH . 'libraries/pear'); // Create application $GLOBALS['app'] = jaws(); // get an instance of Jaws_DB $objDatabase = Jaws_DB::getInstance('default', $db); if (Jaws_Error::IsError($objDatabase)) { Jaws_Error::Fatal($objDatabase->getMessage()); } $db_jaws_version = $GLOBALS['app']->Registry->Init(); if ($db_jaws_version != JAWS_VERSION) { if (strrstr(JAWS_VERSION, '.', true) != strrstr($db_jaws_version, '.', true)) { //require_once JAWS_PATH . 'upgrade/JawsUpgrader.php'; //require_once JAWS_PATH . 'upgrade/JawsUpgraderStage.php'; //require_once JAWS_PATH . 'upgrade/stages/111To120.php'; //$objStage = new Upgrader_111To120; //$result = $objStage->Run(); //if (Jaws_Error::IsError($result)) { Jaws_Header::Location('upgrade/index.php'); //} } $GLOBALS['app']->Registry->update('version', JAWS_VERSION); } // init application $GLOBALS['app']->init(); // load Piwi initialize require_once JAWS_PATH . 'include/Jaws/InitPiwi.php';
/** * Cleans the arguments array. * This method removes all whitespaces and the leading "$" sign from each argument * in the array. * * @static * @access private * @param $args(Array) The "dirty" array with arguments. */ function cleanArguments($args, $commentParams) { $result = array(); if (!is_array($args)) { return array(); } foreach ($args as $index => $arg) { $arg = strrstr(str_replace(array('$', '&$'), array('', '&'), $arg), '='); if (!isset($commentParams[$index])) { $result[] = trim($arg); } else { $start = trim($arg); $end = trim(str_replace('$', '', $commentParams[$index])); // Suppress Notice of 'Undefined offset' with @ @(list($word0, $word1, $tail) = preg_split("/[\\s]+/", $end, 3)); $word0 = strtolower($word0); $word1 = strtolower($word1); $wordBase0 = ereg_replace('^[&$]+', '', $word0); $wordBase1 = ereg_replace('^[&$]+', '', $word1); $startBase = strtolower(ereg_replace('^[&$]+', '', $start)); if ($wordBase0 == $startBase) { $type = str_replace(array('(', ')'), '', $word1); } elseif ($wordBase1 == $startBase) { $type = str_replace(array('(', ')'), '', $word0); } elseif (ereg('(^[&$]+)|(\\()([a-z0-9]+)(\\)$)', $word0, $regs)) { $tail = str_ireplace($word0, '', $end); $type = $regs[3]; } else { // default to string $type = 'string'; } $type = MethodTable::standardizeType($type); /* if($type == 'str') { $type = 'string'; } elseif($type == 'int' || $type == 'integer') { $type = 'int'; } elseif($type == 'bool' || $type == 'boolean') { $type = 'boolean'; } elseif($type == 'object' || $type == 'class') { // Note that this is not a valid XMLRPC type $type = 'object'; } elseif($type == 'float' || $type == 'dbl' || $type == 'double' || $type == 'flt') { $type = 'double'; } elseif($type == 'null') { // Note that this is not a valid XMLRPC type // The null type can have only one value - null. Why would // that be an argument to a function? Just in case: $type = 'null'; } elseif($type == 'mixed') { // Note that this is not a valid XMLRPC type $type = 'mixed'; } elseif($type == 'array' || $type == 'arr') { $type = 'array'; } elseif($type == 'assoc') { $type = 'struct'; } elseif($type == 'reference' || $type == 'ref') { // Note that this is not a valid XMLRPC type // As references cannot be serialized or exported, there is // no way this could be XML-RPCed. $type = 'reference'; } else { $type = 'string'; } */ $result[] = array('type' => $type, 'description' => $start . ' - ' . $tail); } } return $result; }
/** * Returns true or false if the gadget is running the version the Info.php says * * @access public * @param string $gadget Gadget name * @return bool True or false, depends of the jaws version */ public static function IsGadgetUpdated($gadget) { static $gadgets_status; if (!isset($gadgets_status)) { $gadgets_status = array(); } if (!array_key_exists($gadget, $gadgets_status)) { $gadgets_status[$gadget] = false; if (self::IsGadgetInstalled($gadget)) { $objGadget = Jaws_Gadget::getInstance($gadget); $current_version = $objGadget->registry->fetch('version'); if (false === ($gadgets_status[$gadget] = $current_version == $objGadget->version)) { // build version not equal if (strrstr($current_version, '.', true) == strrstr($objGadget->version, '.', true)) { $gadgets_status[$gadget] = true; // update build version $objGadget->registry->update('version', $objGadget->version); } } } } return $gadgets_status[$gadget]; }
/** * Cleans the arguments array. * This method removes all whitespaces and the leading "$" sign from each argument * in the array. * * @static * @access private * @param $args(Array) The "dirty" array with arguments. */ function cleanArguments($args, $commentParams) { $result = array(); foreach ($args as $index => $arg) { $arg = strrstr(str_replace('(', '', $arg), '='); if (!isset($commentParams[$index])) { $result[] = trim($arg); } else { $start = trim($arg); $end = trim(str_replace('$', '', $commentParams[$index])); //echo($start); //echo($end); if ($end != "" && $start != "" && strpos(strtolower($end), strtolower($start)) === 0) { $end = substr($end, strlen($start)); } $result[] = $start . ' - ' . trim($end); } } return $result; }
/** * * */ private static function getMethodCommentAttributeFirstWord($comment, $attribute){ $pieces = strstrafter($comment, '@' . $attribute); if($pieces !== FALSE) { $val = MethodTable::cleanComment($pieces); return trim(strrstr($val, ' ')); } return ""; }
function fetch_via_phpbb_llpnf($fansub_id, $url, $last_fetched_item_date) { $elements = array(); $base_url = substr($url, 0, strrpos($url, '/')); $tidy_config = "tidy.conf"; $error_connect = FALSE; $html_text = file_get_contents($url) or $error_connect = TRUE; if ($error_connect) { return array('error_connect', array()); } $tidy = tidy_parse_string($html_text, $tidy_config, 'UTF8'); tidy_clean_repair($tidy); $html = str_get_html(tidy_get_output($tidy)); $go_on = TRUE; while ($go_on) { //parse through the HTML and build up the elements feed as we go along foreach ($html->find('a.topictitle') as $topic) { if (strpos($topic->innertext, 'Com funciona Lluna Plena no Fansub?') === FALSE && strpos($topic->innertext, 'Tret de sortida dels regals!') === FALSE && strpos($topic->innertext, 'Nou funcionament del blog i les notícies') === FALSE && strpos($topic->innertext, 'Necessitem gent!') === FALSE && strpos($topic->innertext, 'Kokoro Connect 01, 02, 03 i 04') === FALSE && strpos($topic->innertext, 'One Piece #732') === FALSE && strpos($topic->innertext, 'Fairy Tail 131, 132 i 133') === FALSE && strpos($topic->innertext, 'Lovely Complex 19') === FALSE && strpos($topic->innertext, 'Temporada d\'anime tardor-hivern a LlPnF') === FALSE && strpos($topic->innertext, 'Sora no Otoshimono #5') === FALSE && strpos($topic->innertext, 'Més enllà dels núvols, el lloc promès') === FALSE) { $html_text_topic = file_get_contents($base_url . $topic->href) or $error_connect = TRUE; if ($error_connect) { return array('error_connect', array()); } $tidy_topic = tidy_parse_string($html_text_topic, $tidy_config, 'UTF8'); tidy_clean_repair($tidy_topic); $html_topic = str_get_html(tidy_get_output($tidy_topic)); $is_blogspot = FALSE; foreach ($html_topic->find('div.post div.content div a img') as $linked_image) { if (strpos($linked_image->parent->href, '.blogspot.') !== FALSE) { $is_blogspot = TRUE; } } if (!$is_blogspot) { //Create an empty item $item = array(); //Look up and add elements to the item $title = $html_topic->find('h2.topic-title a', 0)->innertext; $item[0] = $title; $description = $html_topic->find('div.post div.content div', 0)->innertext; $item[1] = $description; $item[2] = parse_description($description); $datetext = $html_topic->find('div.post p.author', 0)->plaintext; //We now have this (only the text): <img class="sprite-icon_post_target" src="http://illiweb.com/fa/empty.gif" alt="Missatge" title="Missatge"> <a href="/u227"><span style="color:#7F0985"><strong>bombillero</strong></span></a> el Dt 05 Jul 2016, 15:08 $datetext = substr(strrstr($datetext, " el "), 4); $datetext = str_ireplace('Gen', 'January', $datetext); $datetext = str_ireplace('Feb', 'February', $datetext); $datetext = str_ireplace('Mar', 'March', $datetext); $datetext = str_ireplace('Abr', 'April', $datetext); $datetext = str_ireplace('Maig', 'May', $datetext); $datetext = str_ireplace('Mai', 'May', $datetext); $datetext = str_ireplace('Jun', 'June', $datetext); $datetext = str_ireplace('Jul', 'July', $datetext); $datetext = str_ireplace('Ago', 'August', $datetext); $datetext = str_ireplace('Set', 'September', $datetext); $datetext = str_ireplace('Oct', 'October', $datetext); $datetext = str_ireplace('Nov', 'November', $datetext); $datetext = str_ireplace('Des', 'December', $datetext); $datetext = str_ireplace('Dl', 'Mon', $datetext); $datetext = str_ireplace('Dt', 'Tue', $datetext); $datetext = str_ireplace('Dc', 'Wed', $datetext); $datetext = str_ireplace('Dj', 'Thu', $datetext); $datetext = str_ireplace('Dv', 'Fri', $datetext); $datetext = str_ireplace('Ds', 'Sat', $datetext); $datetext = str_ireplace('Dg', 'Sun', $datetext); $date = date_create_from_format('D d F Y, H:i', $datetext); $item[3] = $date->format('Y-m-d H:i:s'); $item[4] = $base_url . $topic->href; $item[5] = fetch_and_parse_image($fansub_id, $url, $description); $elements[] = $item; } } } $go_on = FALSE; //This fetching method has no support for pre-existing data. All data is fetched again each time. //If not used as onetime, will lead to duplicates if ($html->find('img.sprite-arrow_prosilver_right', 0) !== NULL) { $html_text = file_get_contents($base_url . $html->find('img.sprite-arrow_prosilver_right', 0)->parent->href) or $error_connect = TRUE; if ($error_connect) { return array('error_connect', array()); } $tidy = tidy_parse_string($html_text, $tidy_config, 'UTF8'); tidy_clean_repair($tidy); $html = str_get_html(tidy_get_output($tidy)); $go_on = TRUE; } } return array('ok', $elements); }