/**
  * Method to get a specific wiki page in HTML
  *
  * @param string $pagename
  * @return string HTML
  */
 public function grabTracWikiPageHTML($pagename)
 {
     $msg = new XML_RPC_Message('wiki.getPageHTML', array(new XML_RPC_Value($pagename, "string")));
     $cli = new XML_RPC_Client($this->tracURL, $this->tracServ);
     $cli->setDebug(0);
     // send the request message
     $resp = $cli->send($msg);
     if (!$resp) {
         throw new customException($this->objLanguage->languageText("mod_filters_commserr", "filters") . ": " . $cli->errstr);
         exit;
     }
     if (!$resp->faultCode()) {
         $val = $resp->value();
         $val = XML_RPC_decode($val);
         if (is_array($val)) {
             return $val['faultString'];
         } else {
             return $val;
         }
     } else {
         /*
          * Display problems that have been gracefully caught and
          * reported by the xmlrpc server class.
          */
         throw new customException($this->objLanguage->languageText("mod_filters_faultcode", "filters") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_filters_faultreason", "filters") . ": " . $resp->faultString());
     }
 }
 /**
  * Method to get a specific wiki page in HTML
  *
  * @param string $pagename
  * @return string HTML
  */
 public function fullGraph()
 {
     $msg = new XML_RPC_Message('dlGraphFull');
     $pserv = $this->objSysConfig->getValue('package_server', 'packages');
     $purl = $this->objSysConfig->getValue('package_url', 'packages');
     $cli = new XML_RPC_Client($purl, $pserv);
     $cli->setDebug(0);
     // send the request message
     $resp = $cli->send($msg);
     if (!$resp) {
         throw new customException($this->objLanguage->languageText("mod_filters_commserr", "filters") . ": " . $cli->errstr);
         exit;
     }
     if (!$resp->faultCode()) {
         $val = $resp->value();
         $val = XML_RPC_decode($val);
         if (is_array($val)) {
             return $val['faultString'];
         } else {
             return $val;
         }
     } else {
         /*
          * Display problems that have been gracefully caught and
          * reported by the xmlrpc server class.
          */
         throw new customException($this->objLanguage->languageText("mod_filters_faultcode", "filters") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_filters_faultreason", "filters") . ": " . $resp->faultString());
     }
 }
 /**
  * Standard init function to instantiate language object
  * and create title, etc
  */
 public function init()
 {
     try {
         $this->objLanguage = $this->getObject('language', 'language');
         $this->title = $this->objLanguage->languageText("word_languages");
     } catch (customException $e) {
         customException::cleanUp();
     }
 }
 /**
  * Standard block show method. It uses the renderform
  * class to render the login box
  */
 public function show()
 {
     try {
         $regLink = $this->newObject('link', 'htmlelements');
         $regLink->link = $this->objLanguage->languageText('word_register');
         $regLink->link($this->uri(NULL, 'userregistration'));
         return $regLink->show();
     } catch (customException $e) {
         customException::cleanUp();
     }
 }
 /**
  * Method to get days as an array
  *
  * @access public
  * @param string $abbrev
  * @return string language item
  */
 public function getDaysAsArray($abbrev = Null)
 {
     switch ($abbrev) {
         case "3letter":
             $caldays = array($this->objLanguage->languageText("mod_datetime_mon"), $this->objLanguage->languageText("mod_datetime_tue"), $this->objLanguage->languageText("mod_datetime_wed"), $this->objLanguage->languageText("mod_datetime_thu"), $this->objLanguage->languageText("mod_datetime_fri"), $this->objLanguage->languageText("mod_datetime_sat"), $this->objLanguage->languageText("mod_datetime_sun"));
             break;
         case "2letter":
             $caldays = array($this->objLanguage->languageText("mod_datetime_mo"), $this->objLanguage->languageText("mod_datetime_tu"), $this->objLanguage->languageText("mod_datetime_we"), $this->objLanguage->languageText("mod_datetime_th"), $this->objLanguage->languageText("mod_datetime_fr"), $this->objLanguage->languageText("mod_datetime_sa"), $this->objLanguage->languageText("mod_datetime_su"));
             break;
         case "1letter":
             $caldays = array($this->objLanguage->languageText("mod_datetime_m"), $this->objLanguage->languageText("mod_datetime_tuy"), $this->objLanguage->languageText("mod_datetime_w"), $this->objLanguage->languageText("mod_datetime_thy"), $this->objLanguage->languageText("mod_datetime_f"), $this->objLanguage->languageText("mod_datetime_say"), $this->objLanguage->languageText("mod_datetime_suy"));
             break;
         default:
             $caldays = array($this->objLanguage->languageText("mod_datetime_monday"), $this->objLanguage->languageText("mod_datetime_tuesday"), $this->objLanguage->languageText("mod_datetime_wednesday"), $this->objLanguage->languageText("mod_datetime_thursday"), $this->objLanguage->languageText("mod_datetime_friday"), $this->objLanguage->languageText("mod_datetime_saturday"), $this->objLanguage->languageText("mod_datetime_sunday"));
             break;
     }
     if ($this->startweek == "sun") {
         // Take sunday from the end and put it first
         $sunday = $caldays[6];
         array_splice($caldays, 6, 1);
         array_unshift($caldays, $sunday);
     }
     //echo implode($caldays, "!");
     return $caldays;
 }
Example #6
0
 /**
  *
  * Get a canvas for display and selection.
  *
  * @access private
  * @return string The formatted canvas for view and selection
  *
  */
 private function getSkinCanvasView($canvas)
 {
     try {
         $dirToOpen = "skins/" . $this->curSkin . "/canvases/";
         $jsonFile = $dirToOpen . $canvas . '/canvas.json';
         $jsonFile = file_get_contents($jsonFile);
         $jsonObj = json_decode($jsonFile);
         $divTag = "<div class='canvasthumb'>";
         $divClose = "</div>";
         $canvasName = $jsonObj->name;
         $canvasName = $this->getSkinChooserLink($canvasName, 'skin');
         $anchor = "<a href='" . $dirToOpen . $canvas . "/" . $jsonObj->preview->fullview . "' rel='facebox'>";
         //gb_imageset[skin_canvases]
         $anchorClose = "</a>";
         $imageLink = "<img src='" . $dirToOpen . $canvas . "/" . $jsonObj->preview->thumb . "' />";
         $by = $this->objLanguage->languageText("word_by");
         $author = $by . ": " . $jsonObj->author->authorname;
         $downloadLink = $this->getDownLink($jsonObj->downloadfrom);
         // @TODO add the download link
         return $divTag . $canvasName . $anchor . $imageLink . $anchorClose . $author . $downloadLink . $divClose;
     } catch (Exception $e) {
         throw customException($e->message());
         exit;
     }
 }
Example #7
0
 /**
  * Dispatch Method
  * @param string $action Action to be taken
  */
 public function dispatch($action)
 {
     // Add login layout if page is displayed outside facebox.
     if (!$this->getParam('facebox')) {
         $this->setLayoutTemplate('login_layout_tpl.php');
     }
     $canRegister = $this->objConfig->getItem('KEWL_ALLOW_SELFREGISTER') != strtoupper('FALSE');
     if (!$canRegister) {
         //Disabling Registration
         return $this->showDisabledMessage();
     } else {
         switch ($action) {
             case 'showregister':
             default:
                 return $this->registrationHome();
             case 'confirm':
                 $id = $this->getParam('newId');
                 if (!empty($id)) {
                     $this->setSession('id', $id);
                     return $this->nextAction('detailssent');
                 }
                 return $this->nextAction('');
             case 'register':
                 return $this->saveNewUser();
             case 'ajax_register':
                 error_log(var_export($_POST, true));
                 //do the registration
                 $results = $this->objUtils->doRegistration($this->getParam('username'), $this->getParam('password'), $this->getParam('request_captcha'), $this->getParam('email'));
                 echo json_encode($results);
                 exit(0);
                 break;
             case 'detailssent':
                 return $this->detailsSent();
             case 'invitefriend':
                 $this->setLayoutTemplate(NULL);
                 return 'invite_tpl.php';
                 break;
             case 'sendinvite':
                 $fn = ucwords($this->getParam('friend_firstname'));
                 $sn = ucwords($this->getParam('friend_surname'));
                 $msg = $this->getParam('friend_msg');
                 $fe = $this->getParam('friend_email');
                 $userthing = $fn . "," . $sn . "," . $fe;
                 $code = base64_encode($userthing);
                 // construct the url
                 $url = $this->objConfig->getSiteRoot() . "index.php?module=userregistration&user="******" <br />" . $url;
                 // bang off the email now
                 $objMailer = $this->getObject('mailer', 'mail');
                 $objMailer->setValue('to', array($fe));
                 $objMailer->setValue('from', $this->objConfig->getsiteEmail());
                 $objMailer->setValue('fromName', $this->objConfig->getSiteName() . " " . $this->objLanguage->languageText("mod_userregistration_emailfromname", "userregistration"));
                 $objMailer->setValue('subject', $this->objLanguage->languageText("mod_userregistration_emailsub", "userregistration") . " " . $this->objConfig->getSiteName());
                 $objMailer->setValue('body', strip_tags($msg));
                 $objMailer->send();
                 $this->nextAction('', array(), '_default');
         }
     }
 }
 /**
  *
  * Embed a WEBM video using HTML5 code
  *
  * @param string $file The file URL to embed
  * @param integer $width The width of the video
  * @param integer $height The height of the video
  * @return string The rendered video HTML5 tags
  * @access public
  */
 public function showWebm($file, $width, $height)
 {
     $ret = "\n\n<video width=\"{$width}\" height=\"{$height}\" controls=\"controls\">\n";
     $ret .= "<source src=\"{$file}\"  type=\"video/webm\"></source>\n";
     $ret .= $this->objLanguage->languageText("mod_files_err_nohtmk5", 'files', "Your browser does not support the HTML5 VIDEO tag.");
     $ret .= "</video>";
     return $ret;
 }
 /**
  * Method to return a language text element.
  *
  * @param  	string 	$itemName   The language code for the item to be looked up
  * @param  	string 	$modulename The module name that owns the string
  * @param 	bool	$default	Default text
  *
  * @return 	string	The language element
  */
 protected function l($itemName, $modulename = NULL, $default = FALSE)
 {
     if (!defined('CHISIMBA_CONTROLLER_OBJLANGUAGE_CREATED')) {
         define('CHISIMBA_CONTROLLER_OBJLANGUAGE_CREATED', TRUE);
         $this->_objLanguage = $this->getObject('language', 'language');
     }
     $module = is_NULL($modulename) ? $this->moduleName : $modulename;
     return $this->_objLanguage->languageText($itemName, $module, $default);
 }
Example #10
0
 /**
  * This is a method to return an array of the registered modules
  * that have a more recent version in code than in the database
  * @returns array $modules
  */
 public function checkModules()
 {
     try {
         $modArray = $this->getAll();
         $modules = array();
         foreach ($modArray as $module) {
             $codeVersion = (double) $this->readVersion($module['module_id']);
             $dbVersion = (double) $module['module_version'];
             // Now compare the two
             //echo "{$module['module_id']} $dbVersion >= $codeVersion<br/>";
             if ($codeVersion > $dbVersion) {
                 //check for xml document
                 $description = $this->readUpdateDesc($module['module_id']);
                 if (empty($description) || $description == '') {
                     $description = $this->objLanguage->languageText('mod_modulecatalogue_newlangitems', 'modulecatalogue');
                 }
                 if ($updateFile = $this->objModFile->findSqlXML($module['module_id'])) {
                     $check = file_get_contents($updateFile);
                     if (!empty($check)) {
                         if (!($objXml = simplexml_load_file($updateFile))) {
                             throw new Exception($this->objLanguage->code2Txt('mod_modulecatalogue_badxml', 'modulecatalogue', array('FILENAME' => $updateFile)));
                         }
                         $desc = $objXml->xpath("//update[version='{$codeVersion}']/description");
                         if (isset($desc[0])) {
                             $description .= $desc[0];
                         }
                     } else {
                         log_debug("WARNING: module {$module['module_id']} has an invalid sql_updates.xml document. Ignoring.");
                     }
                 }
                 // else add in the description from the register file
                 $modules[] = array('module_id' => $module['module_id'], 'old_version' => $dbVersion, 'new_version' => $codeVersion, 'desc' => $description);
             }
         }
         return $modules;
     } catch (customException $e) {
         echo $e->getMessage();
         $e->cleanUp();
         exit(0);
     } catch (Exception $e) {
         echo $e->getMessage();
         exit(0);
     }
 }
 /**
  * Generate the (X)HTML to display the customised form.
  *
  * @return string The generated (X)HTML.
  */
 function show()
 {
     // Get the parameter description.
     $description = '<p>' . $this->objLanguage->languageText('mod_creativecommons_default', 'creativecommons') . '</p>';
     // Load the radio button class form the htmlelements module.
     $this->loadClass('radio', 'htmlelements');
     // The name of the input field must be "pvalue".
     $objElement = new radio('pvalue');
     // Add the licenses as options.
     foreach ($this->objCC->getAll() as $license) {
         $objElement->addOption($license['code'], $license['title']);
     }
     // Have the current value selected by default.
     $objElement->setSelected($this->defaultValue);
     // Display the radio buttons on separate lines.
     $objElement->setBreakSpace('<br />');
     // Return the output.
     return $description . $objElement->show();
 }
Example #12
0
 /**
  * 
  * Renames a file/folder. Needs oldFilePath and newFilePath to be set
  * to a valid path before hand
  * 
  * @access Public
  *                
  */
 function rename()
 {
     if ($this->oldFilePath != NULL && $this->newFilePath != NULL) {
         rename($this->oldFilePath, $this->newFilePath);
         //If the file path is null
     } else {
         $this->err = TRUE;
         $this->errMsg = $this->objLanguage->languageText('mod_files_err_nofilepath') . ": Old - " . $this->oldFilePath . ",  New - " . $this->newFilePath;
         return FALSE;
     }
 }
Example #13
0
 /**
  * Method to search for contexts
  */
 private function __search()
 {
     $search = $this->getParam('search');
     $results = $this->objContext->searchContext($search);
     if (count($results) == 0) {
         $this->setVar('content', $this->objLanguage->languageText('mod_contextadmin_nosearchresultsfor', 'contextadmin', 'No search results for') . ' ' . $search);
     } else {
         $this->setVarByRef('contexts', $results);
     }
     $this->setVar('title', $this->objLanguage->languageText('phrase_searchresultsfor', 'system', 'Search Results for') . ' <em>' . $search . '</em>');
     return 'main.php';
 }
 /**
  * Method to grab a specified module's description
  *
  * @param string $module
  * @return string
  */
 public function getModuleDescription($module)
 {
     //grab the module name
     $mod = $module->getParam(0);
     $name = $this->objCatalogueConfig->getModuleName($mod->scalarval());
     $desc = $this->objCatalogueConfig->getModuleDescription($mod->scalarval());
     $data[0] = new XML_RPC_Value((string) $name[0], 'string');
     $data[1] = new XML_RPC_Value((string) $desc[0], 'string');
     $val = new XML_RPC_Value($data, 'array');
     return new XML_RPC_Response($val);
     // Ooops, couldn't open the file so return an error message.
     return new XML_RPC_Response(0, $XML_RPC_erruser + 1, $this->objLanguage->languageText("mod_packages_fileerr", "packages"));
 }
 public function grabWikiPage($pagename, $wikiname, $url = '/index.php?module=api', $serv = 'fsiu.uwc.ac.za')
 {
     $msg = new XML_RPC_Message('chiswiki.getPage', array(new XML_RPC_Value($pagename, "string"), new XML_RPC_Value($wikiname, "string")));
     $cli = new XML_RPC_Client($url, $serv);
     $cli->setDebug(0);
     // send the request message
     $resp = $cli->send($msg);
     if (!$resp) {
         throw new customException($this->objLanguage->languageText("mod_filters_commserr", "filters") . ": " . $cli->errstr);
         exit;
     }
     if (!$resp->faultCode()) {
         $val = $resp->value();
         return $val->serialize($val);
     } else {
         /*
          * Display problems that have been gracefully caught and
          * reported by the xmlrpc server class.
          */
         throw new customException($this->objLanguage->languageText("mod_filters_faultcode", "filters") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_filters_faultreason", "filters") . ": " . $resp->faultString());
     }
 }
 /**
  * Method to get the difference between two dates translated same as above but the result is without the html attached
  * @param string $date1 First Date
  * @param string $date2 Second Date
  * @return string Difference translated and expressed in a human readable format
  */
 public function getDifference_no_html($date1, $date2 = '')
 {
     // Set 2nd Date to current date and time if not given
     if ($date2 == '') {
         $date2 = date('Y-m-d H:i:s');
     }
     // Swap around if first date is bigger than second date
     if ($date1 > $date2) {
         $temp = $date2;
         $date2 = $date1;
         $date1 = $temp;
     }
     // Get the difference as an array
     $difference = $this->objDateFunctions->dateDifference($date1, $date2);
     // If more than one days difference
     if ($difference['d'] > 1) {
         return $difference['d'] . ' ' . $this->objLanguage->languageText('mod_datetime_days', 'system', 'days') . ' ' . $this->objLanguage->languageText('mod_datetime_ago', 'utilities', 'ago');
     } else {
         if ($difference['d'] > 0) {
             // If previous day
             return 24 + $difference['h'] . ' ' . $this->objLanguage->languageText('mod_datetime_hours', 'system', 'hours') . ' ' . $this->objLanguage->languageText('mod_datetime_ago', 'utilities', 'ago');
         } else {
             // If today
             if ($difference['h'] > 1) {
                 // If more than one hour
                 $returnString = $difference['h'] . ' ' . $this->objLanguage->languageText('mod_datetime_hours', 'system', 'hours') . ', ';
             } else {
                 if ($difference['h'] > 0) {
                     $returnString = $difference['h'] . ' ' . $this->objLanguage->languageText('mod_datetime_hour', 'system', 'hour') . ', ';
                 } else {
                     $returnString = '';
                 }
             }
             if ($difference['m'] > 1) {
                 // if more than one minute
                 $returnString .= $difference['m'] . ' ' . $this->objLanguage->languageText('mod_datetime_minutes', 'system', 'minutes') . ' ';
             } else {
                 if ($difference['m'] > 0) {
                     $returnString = $difference['h'] . ' ' . $this->objLanguage->languageText('mod_datetime_minute', 'system', 'minute') . ' ';
                 }
             }
             if ($difference['h'] == 0 && $difference['m'] == 0) {
                 return $difference['s'] . ' ' . $this->objLanguage->languageText('mod_datetime_seconds', 'system', 'seconds') . ' ' . $this->objLanguage->languageText('mod_datetime_ago', 'system', 'ago');
                 return $difference['s'] . ' ' . $this->objLanguage->languageText('mod_datetime_seconds', 'system', 'seconds') . ' ' . $this->objLanguage->languageText('mod_datetime_ago', 'system', 'ago');
             } else {
                 return $returnString . ' ' . $this->objLanguage->languageText('mod_datetime_ago', 'system', 'ago');
             }
             return $returnString;
         }
     }
 }
Example #17
0
 /**
  * 
  * Create a folder. Needs fullFilePath to be set
  * to a valid directory before hand
  * 
  * @access Public
  *                
  */
 function makedir()
 {
     if ($this->fullFilePath != NULL) {
         //Check if its a file
         if (is_file($this->fullFilePath)) {
             $this->err = TRUE;
             $this->errMsg = $this->objLanguage->languageText('mod_files_err_isfilenotdir') . ": " . $this->fullFilePath;
         } else {
             mkdir($this->fullFilePath);
         }
         //If the file path is null
     } else {
         $this->err = TRUE;
         $this->errMsg = $this->objLanguage->languageText('mod_files_err_nofilepath') . ": " . $this->fullFilePath;
         return FALSE;
     }
 }
 /**
  * Standard block show method.
  *
  * @return string $this->display block rendered
  * @access public
  */
 public function show()
 {
     $ret = "";
     $persCan = $this->objLanguage->languageText("mod_canvas_typepersonal", "canvas");
     $persUri = $this->uri(array('action' => 'select', 'ctype' => 'personal'), 'canvas');
     // Only allow admin users to change the site skins
     if ($this->objUser->isAdmin()) {
         $skinCan = $this->objLanguage->languageText("mod_canvas_typeskin", "canvas");
         $skinUri = $this->uri(array('action' => 'select', 'ctype' => 'skin'), 'canvas');
         $objLink = new link($skinUri);
         $objLink->link = $skinCan;
         $ret .= $objLink->show();
     }
     $objLink = new link($persUri);
     $objLink->link = $persCan;
     $ret .= "<br />" . $objLink->show();
     return "<div class='canvas_selectblock'>{$ret}</div>";
 }
    /**
     * Standard block show method. It uses the renderform
     * class to render the login box
     */
    public function show()
    {
        //$objTab = $this->newObject('jqtabs', 'htmlelements');
        $objTab = $this->newObject('tabpane', 'htmlelements');
        $objUtils = $this->getObject('utilities', 'context');
        $objSysConfig = $this->getObject('altconfig', 'config');
        $objNav = $this->getObject('contextadminnav', 'contextadmin');
        $str = $this->objLanguage->languageText('word_browse', 'glossary', 'Browse') . ': ' . $objNav->getAlphaListingAjax();
        $str2 = '<div id="browseusercontextcontent"></div>';
        $str .= '<div id="browsecontextcontent"></div>';
        $str3 = '<div id="browseallcontextcontent"></div>';
        $siteUri = "";
        $isAdmin = $this->objUser->isAdmin() ? "true" : "false";
        $str .= $this->getJavaScriptFile('contextbrowser.js');
        $this->appendArrayVar('headerParams', '
        	<script type="text/javascript">
        	var pageSize = 100;
        	var lang = new Array();
        	lang["mycontext"] =   "' . ucWords($this->objLanguage->code2Txt('phrase_mycourses', 'system', NULL, 'My [-contexts-]')) . '";
        	lang["contexts"] =   "' . ucWords($this->objLanguage->code2Txt('wordcontext', 'system', NULL, '[-contexts-]')) . '";
        	lang["context"] =   "' . ucWords($this->objLanguage->code2Txt('wordcontext', 'system', NULL, '[-context-]')) . '";
        	lang["othercontext"] =   "' . ucWords($this->objLanguage->code2Txt('phrase_othercourses', 'system', NULL, 'Other [-contexts-]')) . '";
        	lang["searchcontext"] =   "' . ucWords($this->objLanguage->code2Txt('phrase_allcourses', 'system', NULL, 'Search [-contexts-]')) . '";
        	lang["contextcode"] =   "' . ucWords($this->objLanguage->code2Txt('mod_context_contextcode', 'system', NULL, '[-contexts-] Code')) . '";
        	lang["lecturers"] =   "' . ucWords($this->objLanguage->code2Txt('word_lecturers', 'system', NULL, '[-authors-]')) . '";
        	
			var uri = "' . str_replace('&amp;', '&', $this->uri(array('module' => 'context', 'action' => 'jsonlistcontext'))) . '"; 
        	var usercontexturi = "' . str_replace('&amp;', '&', $this->uri(array('module' => 'context', 'action' => 'jsonusercontexts'))) . '"; 
			var othercontexturi = "' . str_replace('&amp;', '&', $this->uri(array('module' => 'context', 'action' => 'jsonusercontexts'))) . '"; 
        		var baseuri = "' . $siteUri . '";
        		var isAdmin = ' . $isAdmin . ';
        		contextPrivateMessage="' . $this->objLanguage->code2Txt('mod_context_privatecontextexplanation', 'context', NULL, 'This is a closed [-context-] only accessible to members') . '"; </script>');
        //Ext stuff
        $objExtJS = $this->getObject('extjs', 'ext');
        $objExtJS->show();
        $ext = $this->getJavaScriptFile('Ext.ux.grid.Search.js', 'context');
        $ext .= $this->getJavaScriptFile('usercontextslist.js', 'context');
        $ext .= $this->getJavaScriptFile('othercontexts.js', 'context');
        $ext .= $this->getJavaScriptFile('search.js', 'context');
        $ext .= $this->getJavaScriptFile('extcontexbrowser.js', 'context');
        $this->appendArrayVar('headerParams', $ext);
        return '<div id="contextbrowser"></div>
				<p>&nbsp;</p>';
    }
    public function getRegForm()
    {
        $this->setScripts();
        $captchaLabel = $this->objLanguage->languageText('phrase_verifyrequest', 'security', 'Verify Request');
        $objCaptcha = $this->getObject('captcha', 'utilities');
        $form = '
                        <div id="demo" class=""ui-dialog-content ui-widget-content">
                            <div id="dialog" title="' . $this->title . '">
                                <div id="message"></div>
                            	
                            
                            	<form id="dialog_form">
                            	<p class="validateTips">All form fields are required.</p>
                            	<fieldset>
                            		<label for="name">' . $this->objLanguage->languageText('word_username', 'system') . '</label>
                            		<input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
                            		<label for="email">' . $this->objLanguage->languageText('word_email', 'system', 'Email') . '</label>
                            		<input type="text" name="email" id="email" value="" class="text ui-widget-content ui-corner-all" />
                            		<label for="password">' . $this->objLanguage->languageText('word_password', 'system') . '</label>
                            		<input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" /> 
                            		<label for="request_captcha">' . $captchaLabel . '</label>
                            		<div id="captchaDiv" style="padding-top:3px;padding-bottom:3px">
                            		  ' . $objCaptcha->show() . '
                            		</div>
                            		<input type="text" name="request_captcha" id="request_captcha" value="" class="text ui-widget-content ui-corner-all" /> 
                            		<a id="redraw">' . $this->objLanguage->languageText('word_redraw', 'security', 'Redraw') . '</a>
                            	</fieldset>
                            	</form>
                            </div>
                        
                        </div>
                        
                        <button id="create-user" >
				           
				               ' . $this->objLanguage->languageText('word_register') . '
				           
				         </button>
    					       
					        ';
        return $form;
    }
 /**
  * Method to get a blog post from the metaweblog api
  *
  * @param string array $ar An array of parseable parameters
  * @param void
  * @return string
  */
 private function getBlogPost($ar)
 {
     // get the server and url from the params
     if (isset($ar['server'])) {
         $this->server = $ar['server'];
     } else {
         $this->server = '127.0.0.1';
     }
     if (isset($this->objExpar->endpoint)) {
         $this->url = $this->objExpar->endpoint . '/index.php?module=api';
     } else {
         $this->url = '/index.php?module=api';
     }
     // OK now get the post ID from the filter text.
     if (isset($ar['postid'])) {
         $this->postid = $ar['postid'];
     } else {
         $this->postid = NULL;
     }
     $params = array(new XML_RPC_Value($this->postid, "string"), new XML_RPC_Value('username', "string"), new XML_RPC_Value('password', "string"));
     // Create the message.
     $msg = new XML_RPC_Message('metaWeblog.getPost', $params);
     $cli = new XML_RPC_Client($this->url, $this->server, $this->port, $this->proxy['proxy_host'], $this->proxy['proxy_port'], $this->proxy['proxy_user'], $this->proxy['proxy_pass']);
     $cli->setDebug(0);
     // Send the request message.
     $resp = $cli->send($msg);
     if (!$resp) {
         throw new customException($this->objLanguage->languageText("mod_packages_commserr", "packages") . ": " . $cli->errstr);
         exit;
     }
     if (!$resp->faultCode()) {
         $val = $resp->value();
         $xml = $val->serialize($val);
         $data = simplexml_load_string($xml);
         return $data->struct->member->value->string;
     } else {
         // Display problems that have been gracefully caught and
         //   reported by the xmlrpc server class.
         throw new customException($this->objLanguage->languageText("mod_packages_faultcode", "packages") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_packages_faultreason", "packages") . ": " . $resp->faultString());
     }
 }
 /**
  * Standard block show method.
  *
  * @return string $this->display block rendered
  * @access public
  */
 public function show()
 {
     if (isset($_SESSION['isCanvas'])) {
         if ($_SESSION['isCanvas'] == TRUE) {
             // Get the type of canvases - admins get skin canvases by default
             if ($this->objUser->isAdmin()) {
                 $cType = $this->getParam('ctype', 'skin');
             } else {
                 $cType = $this->getParam('ctype', 'personal');
             }
             // Get the viewer
             $objViewer = $this->getObject('getcanv', 'canvas');
             $ret = $objViewer->getCanvases($cType);
             if ($ret == "" || $ret == NULL) {
                 $ret = "<div class='warning'>" . $this->objLanguage->languageText("mod_canvas_noperscan", "canvas") . "</div>";
             }
             return "<div class='canvas_main'>{$ret}</div>";
         }
     }
     return "<span class='warning'>" . $this->objLanguage->languageText("mod_canvas_notenabled", "canvas") . "</span>";
 }
Example #23
0
 /**
  *
  *  Same as the showBlock method, but with extra security for showing external
  *  blocks
  *
  * @param string $block The block to render
  * @param string $module The module from which to retrieve the block
  * @param string $blockType The blocktype
  * @param string $titleLength The length to wrap the title
  * @param boolean TRUE|FALSE $wrapStr Whether or not to wrap the title
  * @param boolean TRUE|FALSE $showToggle Show the toggle button
  * @param string $hidden Whether or not the block is hidden first
  * @param boolean TRUE|FALSE  $showTitle Whether or not to show the title
  * @param string $cssClass The CSS class to wrap the block into
  * @param string $cssId The CSS ID for the block, if any
  * @return string The rendered block
  *
  */
 public function showBlockExternal($block, $module, $blockType = NULL, $titleLength = 20, $wrapStr = TRUE, $showToggle = TRUE, $hidden = 'default', $showTitle = TRUE, $cssClass = 'featurebox', $cssId = '', $configData = NULL)
 {
     $objSysConfig = $this->getObject('dbsysconfig', 'sysconfig');
     $isAllowed = $objSysConfig->getValue('ALLOW_EXTERNAL_BLOCKS', 'blocks');
     if ($isAllowed == 1) {
         if ($this->loadBlock($block, $module)) {
             if (isset($this->objBlock->expose)) {
                 return $this->fetchBlock($block, $module, $blockType, $titleLength, $wrapStr, $showToggle, $hidden, $showTitle, $cssClass, $cssId, $configData);
             } else {
                 return '<div class="featurebox"><div class="error">' . $this->objLanguage->languageText('mod_blocks_notexposed', 'blocks', 'The requested block is not exposed for external
                         display on remote systems.') . '</div></div>';
             }
         } else {
             return '<div class="featurebox"><div class="error">' . $this->objLanguage->languageText('mod_blocks_notfoundremote', 'blocks', 'The requested block was not found in the
                     module from which it was requested on the remote site.') . '</div></div>';
         }
     } else {
         return '<div class="featurebox"><div class="error">' . $this->objLanguage->languageText('mod_blocks_externaldisabled', 'blocks', 'Provision of external blocks is disabled on
              the server from which you are requesting the block.') . '</div></div>';
     }
 }
 /**
  * Standard block show method. It builds the output based
  * on data obtained via the user class
  */
 public function show()
 {
     // Build the display table
     $this->rTable = $this->newObject('htmltable', 'htmlelements');
     //The number of times the user has logged in
     $this->rTable->startRow();
     $this->rTable->addCell($this->objLanguage->languageText("phrase_numberoflogins") . ":<span class=\"highlight\"> " . $this->objUser->logins() . "</span>");
     $this->rTable->endRow();
     //The date and time of last login
     $lastOnDate = $this->objUser->getLastLoginDate();
     $lastOnDate = date("l, F jS Y - H:i:s", strtotime($lastOnDate));
     $this->rTable->startRow();
     $this->rTable->addCell("<font size=\"-2\"><b>" . $this->objLanguage->languageText("phrase_lastlogin") . "</b>: <span class=\"highlight\">" . $lastOnDate . "</span></font>");
     $this->rTable->endRow();
     //The time the current user has been active
     $this->rTable->startRow();
     $this->rTable->addCell("<font size=\"-2\"><b>" . $this->objLanguage->languageText("phrase_timeactive") . "</b>: <span class=\"highlight\">" . $this->objUser->myTimeOn() . " " . $this->objLanguage->languageText("mod_datetime_mins") . "</span></font>");
     $this->rTable->endRow();
     //Return the formatted table
     return $this->rTable->show();
 }
 public function getCoreZip($modName)
 {
     $msg = new XML_RPC_Message('getEngineUpgrade');
     $cli = new XML_RPC_Client($this->mirrorurl, $this->mirrorserv, $this->port, $this->proxy['proxy_host'], $this->proxy['proxy_port'], $this->proxy['proxy_user'], $this->proxy['proxy_pass']);
     $cli->setDebug(0);
     // send the request message
     $resp = $cli->send($msg);
     //log_debug($resp);
     if (!$resp) {
         throw new customException($this->objLanguage->languageText("mod_packages_commserr", "packages") . ": " . $cli->errstr);
         exit;
     }
     if (!$resp->faultCode()) {
         $val = $resp->value();
         return $val->serialize($val);
     } else {
         /*
          * Display problems that have been gracefully caught and
          * reported by the xmlrpc server class.
          */
         throw new customException($this->objLanguage->languageText("mod_packages_faultcode", "packages") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_packages_faultreason", "packages") . ": " . $resp->faultString());
     }
 }
Example #26
0
 /**
  * 
  * Delete the file specified in $fullFilePath
  * inline {@internal checks the OS php is running on, and execute appropriate command}}
  * @access Public
  * @param  string $type file | folder if its a file or a folder
  * @return bool   TRUE | FALSE, sets error if error occurs
  *                
  */
 function delete()
 {
     if ($this->fullFilePath != NULL) {
         //Check if its a file
         if (is_file($this->fullFilePath)) {
             //DO the unlink and check for success
             if (unlink($this->fullFilePath)) {
                 return TRUE;
             } else {
                 $this->err = TRUE;
                 $this->errMsg = $this->objLanguage->languageText('mod_files_err_unable2del') . ": " . $this->fullFilePath;
             }
         } else {
             $this->err = TRUE;
             $this->errMsg = $this->objLanguage->languageText('mod_files_err_isdirnotfile') . ": " . $this->fullFilePath;
         }
         //If the file path is null
     } else {
         $this->err = TRUE;
         $this->errMsg = $this->objLanguage->languageText('mod_files_err_nofilepath') . ": " . $this->fullFilePath;
         return FALSE;
     }
 }
 /**
  * Method to render the block
  */
 public function show()
 {
     // Check Context Code is Valid
     if ($this->contextCode == 'root' || $this->contextCode == '') {
         return '';
     }
     // Get Context Details
     $contextDetails = $this->objContext->getContextDetails($this->contextCode);
     // Check that Context Exists
     if ($contextDetails == FALSE) {
         return '';
     }
     // Prepare Block
     $objContextImage = $this->getObject('contextimage');
     $objIcon = $this->newObject('geticon', 'htmlelements');
     $image = $objContextImage->getContextImage($this->contextCode);
     if ($image == FALSE) {
         $objIcon->setIcon('imagepreview');
         $image = $objIcon->show();
     } else {
         $image = '<img src="' . $image . '" />';
     }
     $table = $this->newObject('htmltable', 'htmlelements');
     $table->startRow();
     $table->addCell($image, 120);
     $str = '<p><strong>' . ucwords($this->objLanguage->code2Txt('mod_context_contexttitle', 'context', NULL, '[-context-] Title')) . '</strong>: ' . $contextDetails['title'] . '</p>';
     $str .= '<p><strong>' . ucwords($this->objLanguage->code2Txt('mod_context_contextstatus', 'context', NULL, '[-context-] status')) . '</strong>: ' . $contextDetails['status'] . '</p>';
     if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'false' || $this->objUser->isAdmin()) {
         $str .= '<p><strong>' . $this->objLanguage->languageText('mod_context_accessettings', 'context', 'Access Settings') . '</strong>: ' . $contextDetails['access'] . '</p>';
     }
     $table->addCell($str);
     $table->endRow();
     $link = new link($this->uri(array('action' => 'updatesettings')));
     $link->link = ucwords($this->objLanguage->code2Txt('mod_context_changecontextsettings', 'context', NULL, 'Change [-context-] Settings'));
     return $table->show() . '<p>' . $link->show() . '</p>';
 }
 /**
  * Method to render an add form to a template
  *
  * @param string $module The module to add the parameter
  */
 function showEditAddForm($pmodule)
 {
     //Create a form
     $formAction = $this->uri(array('action' => 'save'));
     //Load the form class
     $this->loadClass('form', 'htmlelements');
     //Create and instance of the form class
     $objForm = new form('sysconfig');
     //Set the action for the form to the uri with paramArray
     $objForm->setAction($formAction);
     //Set the displayType to 3 for freeform
     $objForm->displayType = 3;
     //Create a heading for the title
     //$objHd = $this->newObject('htmlheading', 'htmlelements');
     //Load the textinput class
     $this->loadClass('textinput', 'htmlelements');
     //Load the label class
     $this->loadClass('label', 'htmlelements');
     //Load the dropdown class
     //Kevin Cyster
     $this->loadClass('dropdown', 'htmlelements');
     //Create an element for the input of module
     $objElement = new textinput("pmodule");
     //Set the value of the element to $module
     if (isset($pmodule)) {
         $objElement->setValue($pmodule);
     }
     //Create label for input of module
     $label = new label($this->objLanguage->languageText("mod_sysconfig_modtxt", 'sysconfig'), "input_pmodule");
     $objForm->addToForm("<p><strong>" . $this->objLanguage->languageText("mod_sysconfig_modtxt", 'sysconfig') . "</strong>: " . $pmodule . "</p>");
     //Get the pk value
     $id = $this->getParam('id');
     //Get the records for editing
     $ar = $this->objDbSysconfig->getRow('id', $id, 'tbl_sysconfig_properties');
     //Get the two values needed
     if (isset($ar)) {
         $pname = $ar['pname'];
         $pvalue = $ar['pvalue'];
     } else {
         $pname = $this->getParam('id', NULL);
         $pvalue = $this->getParam('value', NULL);
     }
     #if
     //Create an element for the input of id
     $objElement = new textinput("id");
     $objElement->fldType = "hidden";
     $objElement->setValue($id);
     $objForm->addToForm($objElement->show());
     //Create an element for the input of id
     $objElement = new textinput("pmodule");
     $objElement->fldType = "hidden";
     $objElement->setValue($pmodule);
     $objForm->addToForm($objElement->show());
     //Add the $name element to the form
     $objForm->addToForm('<p><b>' . $this->objLanguage->languageText("mod_sysconfig_paramname", 'sysconfig') . '</b>: ' . $pname . '</p>');
     // Check in Config folder if module is gives as _site_
     if ($pmodule == '_site_') {
         $moduleToCheck = 'config';
     } else {
         $moduleToCheck = $pmodule;
     }
     // Load object that checks if class exists
     $checkobject = $this->getObject('checkobject', 'utilities');
     // Check if class 'sysconfig_{pname}' exists in module.
     if ($checkobject->objectFileExists('sysconfig_' . str_replace('/', '_', str_replace('-', '_', $pname)), $moduleToCheck)) {
         // If yes, instantiate the object
         $objParamValue = $this->getObject(strtolower('sysconfig_' . str_replace('/', '_', str_replace('-', '_', $pname))), $moduleToCheck);
         // send it the current default value
         $objParamValue->setDefaultValue($pvalue);
     } else {
         $valueLabel = new label($this->objLanguage->languageText("mod_sysconfig_paramvalue", 'sysconfig'), "input_pvalue");
         //Add the $value element to the form
         $objForm->addToForm("<b>" . $valueLabel->show() . "</b>: ");
         //Create an element for the input of value
         $objParamValue = new textinput("pvalue");
         $objParamValue->size = "50";
         //Set the value of the element to $value
         if (isset($pvalue)) {
             $objParamValue->setValue($pvalue);
         }
         #if
     }
     //Create text add link
     $objForm->addToForm($objParamValue->show() . "<br /><br />");
     // Create an instance of the button object and add a save button to the form
     $this->loadClass('button', 'htmlelements');
     // Create a submit button
     $objElement = new button('submit');
     // Set the button type to submit
     $objElement->setToSubmit();
     // Use the language object to add the word save
     $objElement->setValue(' ' . $this->objLanguage->languageText("word_save") . ' ');
     // Add the button to the form
     $objForm->addToForm('<br/>' . $objElement->show());
     //Add the form
     return $objForm->show();
 }
Example #29
0
 /**
  * Method to process actions to be taken
  *
  * @param string $action String indicating action to be taken
  */
 public function dispatch($action = Null)
 {
     switch ($action) {
         default:
             return 'noaction_tpl.php';
             break;
         case 'dberror':
             //check for a dead database as well
             //$dsn = KEWL_DB_DSN;
             //$dsn = $this->parseDSN($dsn);
             // Connect to the database
             //require_once 'MDB2.php';
             //MDB2 has a factory method, so lets use it now...
             //$checkdb = &MDB2::connect($dsn);
             //Check for errors on the connect method
             //if (PEAR::isError($checkdb)) {
             //    $devmsg = $checkdb->getMessage();
             //    $usrmsg = $checkdb->getUserInfo();
             //    $this->setVarByRef('devmsg',$devmsg);
             //    $this->setVarByRef('usrmsg',$usrmsg);
             //    return 'dberror_tpl.php';
             //   break;
             // }
             $devmsg = $this->getParam('devmsg');
             $usrmsg = $this->getParam('usrmsg');
             $this->setVarByRef('devmsg', $devmsg);
             $this->setVarByRef('usrmsg', $usrmsg);
             return 'dberror_tpl.php';
             break;
         case 'errormail':
             $hidmsg = $this->getParam('error');
             $captcha = $this->getParam('request_captcha');
             if (empty($hidmsg)) {
                 //possible spam usage!!!
                 return 'spam_tpl.php';
                 exit;
             }
             $text = $this->getParam('comments');
             try {
                 //load up the mail class
                 $this->objMail = $this->newObject('email', 'mail');
                 //set up the mailer
                 $objMailer = $this->getObject('mailer', 'mail');
                 $objMailer->setValue('to', array($this->objConfig->getsiteEmail(), '*****@*****.**'));
                 $objMailer->setValue('from', $this->objUser->email());
                 $objMailer->setValue('fromName', $this->objUser->fullname());
                 $objMailer->setValue('subject', $this->objLanguage->languageText("mod_errors_errsubject", "errors"));
                 $objMailer->setValue('body', $text . "  " . $hidmsg . " " . $this->objConfig->getSiteName() . " " . $this->objConfig->getSiteRoot());
                 if (md5(strtoupper($captcha)) != $this->getParam('captcha') || empty($captcha)) {
                     return 'spam_tpl.php';
                     break;
                 } else {
                     $objMailer->send();
                     return 'thanks_tpl.php';
                     break;
                 }
             } catch (customException $e) {
                 customException::cleanUp();
                 exit;
             }
             //$this->objMail->
             //echo $hidmsg . "<br /><br />" . $text;
             break;
         case 'syserr':
             $mess = $this->getParam('msg');
             $mess = urldecode(htmlentities($mess));
             $this->setVarByRef('mess', $mess);
             return "syserror_tpl.php";
             break;
     }
 }
 /**
  * Method to put a form field button
  */
 public function formButton($type, $label)
 {
     global $objLanguage;
     $ret = '<input type="' . $type . '" name="' . $label . '" value="' . $this->objLanguage->languageText("word_{$label}") . '" class="button" />';
     return $ret;
 }