function getGadgets() { global $toC_Json, $osC_Language; $record = array(); $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/gadgets'); if ($osC_DirectoryListing->getSize()) { foreach ($osC_DirectoryListing->getFiles() as $file) { $gadget = substr($file['name'], 0, strrpos($file['name'], '.')); $class_path = 'includes/modules/gadgets/' . $gadget . '.php'; if (!empty($gadget) && file_exists($class_path)) { include $class_path; $osC_Language->loadIniFile('modules/gadgets/' . $gadget . '.php'); if (class_exists('toC_Gadget_' . $gadget)) { $module_class = 'toC_Gadget_' . $gadget; $module = new $module_class(); $records[] = array('code' => $module->getCode(), 'type' => $module->getType(), 'icon' => $module->getIcon(), 'title' => $module->getTitle(), 'file' => $module->getFile(), 'description' => $module->getDescription()); } } } $response = array('success' => true, 'records' => $records); } else { $response = array('success' => false); } echo $toC_Json->encode($response); }
function getPages() { global $toC_Json, $osC_Database, $osC_Language; $Qtemplate = $osC_Database->query('select code from :table_templates where id = :id'); $Qtemplate->bindTable(':table_templates', TABLE_TEMPLATES); $Qtemplate->bindValue(':id', $_REQUEST['filter']); $Qtemplate->execute(); $filter_id = $_REQUEST['filter']; $_REQUEST['filter'] = $Qtemplate->Value('code'); $pages_array = array(array('id' => $filter_id . '/*', 'text' => '*')); $d_boxes = new osC_DirectoryListing('../templates/' . $_REQUEST['filter'] . '/content'); $d_boxes->setRecursive(true); $d_boxes->setAddDirectoryToFilename(true); $d_boxes->setCheckExtension('php'); $d_boxes->setExcludeEntries('.svn'); foreach ($d_boxes->getFiles(false) as $box) { if ($box['is_directory'] === true) { $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*'); } else { $page_filename = substr($box['name'], 0, strrpos($box['name'], '.')); $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename); } if ($_REQUEST['filter'] != DEFAULT_TEMPLATE && $d_boxes->getSize() > 0) { $entry['group'] = '-- ' . $_REQUEST['filter'] . ' --'; } $pages_array[] = $entry; } if ($_REQUEST['filter'] != DEFAULT_TEMPLATE) { $d_boxes = new osC_DirectoryListing('../templates/' . DEFAULT_TEMPLATE . '/content'); $d_boxes->setRecursive(true); $d_boxes->setAddDirectoryToFilename(true); $d_boxes->setCheckExtension('php'); $d_boxes->setExcludeEntries('.svn'); foreach ($d_boxes->getFiles(false) as $box) { if ($box['is_directory'] === true) { $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*'); } else { $page_filename = substr($box['name'], 0, strrpos($box['name'], '.')); $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename); } $check_entry = $entry; $check_entry['group'] = '-- ' . $_REQUEST['filter'] . ' --'; if (!in_array($check_entry, $pages_array)) { $entry['group'] = '-- ' . DEFAULT_TEMPLATE . ' --'; $pages_array[] = $entry; } } } $response = array(EXT_JSON_READER_ROOT => $pages_array); echo $toC_Json->encode($response); }
$boxes_array[] = array('id' => $Qboxes->valueInt('id'), 'text' => $Qboxes->value('title')); } $pages_array = array(array('id' => $filter_id . '/*', 'text' => '*')); $d_boxes = new osC_DirectoryListing('../templates/' . $_GET['filter'] . '/content'); $d_boxes->setRecursive(true); $d_boxes->setAddDirectoryToFilename(true); $d_boxes->setCheckExtension('php'); $d_boxes->setExcludeEntries('.svn'); foreach ($d_boxes->getFiles(false) as $box) { if ($box['is_directory'] === true) { $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*'); } else { $page_filename = substr($box['name'], 0, strrpos($box['name'], '.')); $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename); } if ($_GET['filter'] != DEFAULT_TEMPLATE && $d_boxes->getSize() > 0) { $entry['group'] = '-- ' . $_GET['filter'] . ' --'; } $pages_array[] = $entry; } if ($_GET['filter'] != DEFAULT_TEMPLATE) { $d_boxes = new osC_DirectoryListing('../templates/' . DEFAULT_TEMPLATE . '/content'); $d_boxes->setRecursive(true); $d_boxes->setAddDirectoryToFilename(true); $d_boxes->setCheckExtension('php'); $d_boxes->setExcludeEntries('.svn'); foreach ($d_boxes->getFiles(false) as $box) { if ($box['is_directory'] === true) { $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*'); } else { $page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
function sendSystemMail($data) { global $osC_Session; $mailer = new osC_Mail(); $mailer->setFrom($this->getAccountName(), $this->getAccountEmail()); foreach ($data['to'] as $to) { $mailer->addTo($to['name'], $to['email']); } if ($data['cc'] != null) { foreach ($data['cc'] as $cc) { $mailer->AddCC($cc['name'], $cc['email']); } } if ($data['bcc'] != null) { foreach ($data['bcc'] as $bcc) { $mailer->AddBCC($bcc['name'], $bcc['email']); } } $mailer->setSubject($data['subject']); if ($data['content_type'] == 'html') { $mailer->setBodyHTML($data['body']); } elseif ($data['content_type'] == 'text') { $mailer->setBodyPlain($data['body']); } $path = DIR_FS_CACHE_ADMIN . 'emails/attachments/' . $osC_Session->getID(); $directory = new osC_DirectoryListing($path); if ($directory->getSize() > 0) { foreach ($directory->getFiles() as $file) { $mailer->AddAttachment($path . '/' . $file['name']); } } if ($mailer->Send()) { $data['messages_flag'] = EMAIL_MESSAGE_SENT_ITEM; return $this->saveSentMessage($data); } return false; }